linux/fs/ocfs2
Xue jiufei 173b04ae6c ocfs2: fix the wrong directory passed to ocfs2_lookup_ino_from_name() when link file
commit 53dc20b9a3 upstream.

In ocfs2_link(), the parent directory inode passed to function
ocfs2_lookup_ino_from_name() is wrong.  Parameter dir is the parent of
new_dentry not old_dentry.  We should get old_dir from old_dentry and
lookup old_dentry in old_dir in case another node remove the old dentry.

With this change, hard linking works again, when paths are relative with
at least one subdirectory.  This is how the problem was reproducable:

  # mkdir a
  # mkdir b
  # touch a/test
  # ln a/test b/test
  ln: failed to create hard link `b/test' => `a/test': No such file or  directory

However when creating links in the same dir, it worked well.

Now the link gets created.

Fixes: 0e048316ff ("ocfs2: check existence of old dentry in ocfs2_link()")
Signed-off-by: joyce.xue <xuejiufei@huawei.com>
Reported-by: Szabo Aron - UBIT <aron@ubit.hu>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Tested-by: Aron Szabo <aron@ubit.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-16 06:59:29 -08:00
..
cluster Merge branch 'for-3.14/core' of git://git.kernel.dk/linux-block 2014-01-30 11:19:05 -08:00
dlm ocfs2/dlm: do not get resource spinlock if lockres is new 2014-10-05 14:52:21 -07:00
dlmfs ocfs2: remove versioning information 2014-01-21 16:19:41 -08:00
Kconfig ocfs2: Make OCFS2_FS depend on CONFIGFS_FS 2011-01-16 21:22:40 +00:00
Makefile ocfs2: remove versioning information 2014-01-21 16:19:41 -08:00
acl.c ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00
acl.h ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00
alloc.c ocfs2: fix issue that ocfs2_setattr() does not deal with new_i_size==i_size 2014-02-10 16:01:43 -08:00
alloc.h ocfs2: Add ocfs2_trim_fs for SSD trim support. 2011-05-23 23:37:18 -07:00
aops.c ocfs2: fix journal commit deadlock 2015-01-16 06:59:29 -08:00
aops.h aio: don't include aio.h in sched.h 2013-05-07 20:16:25 -07:00
blockcheck.c ocfs2: kill endianness abuses in blockcheck.c 2012-05-29 23:28:35 -04:00
blockcheck.h
buffer_head_io.c ocfs2: do not put bh when buffer_uptodate failed 2014-05-06 07:59:36 -07:00
buffer_head_io.h
dcache.c ocfs2: needs ->d_lock to poke in ->d_parent->d_inode from ->d_revalidate() 2013-09-29 22:02:20 -04:00
dcache.h Track negative entries v3 2010-09-10 09:18:15 -07:00
dir.c ocfs2: return ENOMEM when sb_getblk() fails 2013-11-13 12:09:00 +09:00
dir.h [readdir] convert ocfs2 2013-06-29 12:57:02 +04:00
dlmglue.c ocfs2: pass ocfs2_cluster_connection to ocfs2_this_node 2014-01-21 16:19:41 -08:00
dlmglue.h ocfs2: Fix lockdep warning in reflink. 2010-09-10 09:19:06 -07:00
export.c fs: encode_fh: return FILEID_INVALID if invalid fid_type 2013-02-26 02:46:10 -05:00
export.h
extent_map.c ocfs2: fix the end cluster offset of FIEMAP 2013-09-11 15:56:53 -07:00
extent_map.h ocfs2: Implement llseek() 2011-07-25 14:58:15 -07:00
file.c ocfs2 syncs the wrong range... 2014-03-10 11:43:32 -04:00
file.h ->permission() sanitizing: don't pass flags to ->permission() 2011-07-20 01:43:24 -04:00
heartbeat.c ocfs2: Remove mlog(0) from fs/ocfs2/heartbeat.c 2011-02-23 21:17:39 +08:00
heartbeat.h
inode.c ocfs2: get rid of impossible checks 2013-11-09 00:16:32 -05:00
inode.h aio: don't include aio.h in sched.h 2013-05-07 20:16:25 -07:00
ioctl.c ocfs2: adjust minlen with discard_granularity in the FITRIM ioctl 2014-01-21 16:19:42 -08:00
ioctl.h Ocfs2: Move ocfs2 ioctl definitions from ocfs2_fs.h to newly added ocfs2_ioctl.h 2010-03-02 14:10:20 -08:00
journal.c ocfs2: use i_size_read() to access i_size 2013-09-11 15:56:30 -07:00
journal.h fs/ocfs2: remove unnecessary variable bits_wanted from ocfs2_calc_extend_credits 2013-11-13 12:09:00 +09:00
localalloc.c ocfs2: free allocated clusters if error occurs after ocfs2_claim_clusters 2014-02-06 13:48:51 -08:00
localalloc.h ocfs2: free allocated clusters if error occurs after ocfs2_claim_clusters 2014-02-06 13:48:51 -08:00
locks.c ocfs2: remove INODE from unused files. 2011-02-21 11:18:23 +08:00
locks.h
mmap.c kill f_vfsmnt 2013-02-26 02:46:10 -05:00
mmap.h
move_extents.c ocfs2: remove redundant ocfs2_alloc_dinode_update_counts() and ocfs2_block_group_set_bits() 2014-01-21 16:19:42 -08:00
move_extents.h Ocfs2/move_extents: move/defrag extents within a certain range. 2011-05-25 15:17:12 +08:00
namei.c ocfs2: fix the wrong directory passed to ocfs2_lookup_ino_from_name() when link file 2015-01-16 06:59:29 -08:00
namei.h ocfs2: Create reflinked file in orphan dir. 2009-09-22 20:09:48 -07:00
ocfs1_fs_compat.h
ocfs2.h ocfs2: add clustername to cluster connection 2014-01-21 16:19:41 -08:00
ocfs2_fs.h Revert wrong fixes for common misspellings 2011-04-26 23:31:11 -07:00
ocfs2_ioctl.h Ocfs2/move_extents: Adding new ioctl code 'OCFS2_IOC_MOVE_EXT' to ocfs2. 2011-05-25 15:17:08 +08:00
ocfs2_lockid.h ocfs2: Add new refcount tree lock resource in dlmglue. 2009-09-22 20:09:28 -07:00
ocfs2_lockingver.h ocfs2_dlmfs: Enable the use of user cluster stacks. 2010-02-26 15:41:18 -08:00
ocfs2_trace.h ocfs2: lighten up allocate transaction 2013-09-11 15:56:28 -07:00
quota.h ocfs2: use system_wq instead of ocfs2_quota_wq 2011-02-01 11:42:42 +01:00
quota_global.c ocfs2: fix quota file corruption 2014-03-04 07:55:48 -08:00
quota_local.c ocfs2: fix quota file corruption 2014-03-04 07:55:48 -08:00
refcounttree.c ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00
refcounttree.h ocfs2: fix NULL pointer dereference in ocfs2_duplicate_clusters_by_page 2013-08-13 17:57:49 -07:00
reservations.c ocfs2: Remove masklog ML_RESERVATIONS. 2011-02-23 22:10:56 +08:00
reservations.h Fix common misspellings 2011-03-31 11:26:23 -03:00
resize.c ocfs2: do not call brelse() if group_bh is not initialized in ocfs2_group_add() 2013-11-13 12:09:01 +09:00
resize.h
slot_map.c ocfs2: Clean up messages in the fs 2011-07-24 10:34:54 -07:00
slot_map.h
stack_o2cb.c ocfs2: pass ocfs2_cluster_connection to ocfs2_this_node 2014-01-21 16:19:41 -08:00
stack_user.c ocfs2: fix sparse non static symbol warning 2014-01-21 16:19:42 -08:00
stackglue.c ocfs2: check if cluster name exists before deref 2014-03-28 13:56:58 -07:00
stackglue.h ocfs2: pass ocfs2_cluster_connection to ocfs2_this_node 2014-01-21 16:19:41 -08:00
suballoc.c ocfs2: remove redundant ocfs2_alloc_dinode_update_counts() and ocfs2_block_group_set_bits() 2014-01-21 16:19:42 -08:00
suballoc.h ocfs2: remove redundant ocfs2_alloc_dinode_update_counts() and ocfs2_block_group_set_bits() 2014-01-21 16:19:42 -08:00
super.c ocfs2: fix NULL pointer dereference when dismount and ocfs2rec simultaneously 2014-01-21 16:19:42 -08:00
super.h treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
symlink.c ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path 2013-02-26 02:46:12 -05:00
symlink.h ocfs: simplify symlink handling 2012-05-29 23:28:40 -04:00
sysfile.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
sysfile.h
uptodate.c ocfs2: Remove masklog ML_UPTODATE. 2011-02-24 16:22:20 +08:00
uptodate.h
xattr.c ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00
xattr.h ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00