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
dlm ocfs2/dlm: do not get resource spinlock if lockres is new 2014-10-05 14:52:21 -07:00
dlmfs
acl.c
acl.h
alloc.c
alloc.h
aops.c ocfs2: fix journal commit deadlock 2015-01-16 06:59:29 -08:00
aops.h
blockcheck.c
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
dir.c
dir.h
dlmglue.c
dlmglue.h
export.c
export.h
extent_map.c
extent_map.h
file.c
file.h
heartbeat.c
heartbeat.h
inode.c
inode.h
ioctl.c
ioctl.h
journal.c
journal.h
Kconfig
localalloc.c
localalloc.h
locks.c
locks.h
Makefile
mmap.c
mmap.h
move_extents.c
move_extents.h
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
ocfs1_fs_compat.h
ocfs2_fs.h
ocfs2_ioctl.h
ocfs2_lockid.h
ocfs2_lockingver.h
ocfs2_trace.h
ocfs2.h
quota_global.c
quota_local.c
quota.h
refcounttree.c
refcounttree.h
reservations.c
reservations.h
resize.c
resize.h
slot_map.c
slot_map.h
stack_o2cb.c
stack_user.c
stackglue.c ocfs2: check if cluster name exists before deref 2014-03-28 13:56:58 -07:00
stackglue.h
suballoc.c
suballoc.h
super.c
super.h
symlink.c
symlink.h
sysfile.c
sysfile.h [PATCH] OCFS2: The Second Oracle Cluster Filesystem 2006-01-03 11:45:47 -08:00
uptodate.c
uptodate.h
xattr.c
xattr.h ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00