android_kernel_google_msm/fs/nfs
Trond Myklebust d3e8a1806b NFS: Don't allow NFS silly-renamed files to be deleted, no signal
commit 5a7a613a47 upstream.

Commit 73ca100 broke the code that prevents the client from deleting
a silly renamed dentry.  This affected "delete on last close"
semantics as after that commit, nothing prevented removal of
silly-renamed files.  As a result, a process holding a file open
could easily get an ESTALE on the file in a directory where some
other process issued 'rm -rf some_dir_containing_the_file' twice.
Before the commit, any attempt at unlinking silly renamed files would
fail inside may_delete() with -EBUSY because of the
DCACHE_NFSFS_RENAMED flag.  The following testcase demonstrates
the problem:
  tail -f /nfsmnt/dir/file &
  rm -rf /nfsmnt/dir
  rm -rf /nfsmnt/dir
  # second removal does not fail, 'tail' process receives ESTALE

The problem with the above commit is that it unhashes the old and
new dentries from the lookup path, even in the normal case when
a signal is not encountered and it would have been safe to call
d_move.  Unfortunately the old dentry has the special
DCACHE_NFSFS_RENAMED flag set on it.  Unhashing has the
side-effect that future lookups call d_alloc(), allocating a new
dentry without the special flag for any silly-renamed files.  As a
result, subsequent calls to unlink silly renamed files do not fail
but allow the removal to go through.  This will result in ESTALE
errors for any other process doing operations on the file.

To fix this, go back to using d_move on success.
For the signal case, it's unclear what we may safely do beyond d_drop.

Reported-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-14 11:29:42 -07:00
..
blocklayout umount oops when remove blocklayoutdriver first 2013-02-28 06:59:02 -08:00
objlayout umount oops when remove blocklayoutdriver first 2013-02-28 06:59:02 -08:00
cache_lib.c
cache_lib.h
callback.c NFS: hard-code init_net for NFS callback transports 2012-07-16 09:04:40 -07:00
callback.h
callback_proc.c
callback_xdr.c
client.c NFS: avoid NULL dereference in nfs_destroy_server 2013-01-11 09:06:54 -08:00
delegation.c
delegation.h
dir.c NFS: Fix calls to drop_nlink() 2013-01-11 09:06:54 -08:00
direct.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
dns_resolve.c NFS: fix bug in legacy DNS resolver. 2012-11-17 13:16:12 -08:00
dns_resolve.h
file.c nfs: skip commit in releasepage if we're freeing memory for fs-related reasons 2012-08-09 08:31:40 -07:00
fscache-index.c
fscache.c
fscache.h
getroot.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
idmap.c NFS: return -ENOKEY when the upcall fails to map the name 2012-09-14 10:00:16 -07:00
inode.c NFS: Fix the initialisation of the readdir 'cookieverf' array 2012-10-02 10:30:19 -07:00
internal.h nfs: Show original device name verbatim in /proc/*/mount{s,info} 2012-11-17 13:16:11 -08:00
iostat.h
Kconfig
Makefile
mount_clnt.c nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts 2012-11-17 13:16:11 -08:00
namespace.c NFS: Don't silently fail setattr() requests on mountpoints 2013-02-03 18:24:42 -06:00
netns.h
nfs2xdr.c
nfs3acl.c
nfs3proc.c NFS: Fix the initialisation of the readdir 'cookieverf' array 2012-10-02 10:30:19 -07:00
nfs3xdr.c
nfs4_fs.h NFS: Fix following referral mount points with different security 2012-04-27 14:10:02 -04:00
nfs4filelayout.c NFS4.1: remove duplicate variable declaration in filelayout_clear_request_commit 2012-03-24 14:33:26 -04:00
nfs4filelayout.h
nfs4filelayoutdev.c NFSv4.1 fix page number calculation bug for filelayout decode buffers 2012-04-26 12:23:23 -04:00
nfs4namespace.c nfs: Show original device name verbatim in /proc/*/mount{s,info} 2012-11-17 13:16:11 -08:00
nfs4proc.c NFS: Add sequence_priviliged_ops for nfs4_proc_sequence() 2013-01-11 09:06:54 -08:00
nfs4renewd.c
nfs4state.c NFSv4: Keep dropped state owners on the LRU list for a while 2012-04-21 13:01:00 -04:00
nfs4xdr.c NFS: return error from decode_getfh in decode open 2012-10-02 10:30:19 -07:00
nfsroot.c
pagelist.c
pnfs.c pnfs: defer release of pages in layoutget 2012-09-14 10:00:15 -07:00
pnfs.h pnfs: defer release of pages in layoutget 2012-09-14 10:00:15 -07:00
pnfs_dev.c
proc.c
read.c NFS: put open context on error in nfs_pagein_multi 2012-04-20 14:54:48 -04:00
super.c nfs: fix null checking in nfs_get_option_str() 2013-01-11 09:06:56 -08:00
symlink.c
sysctl.c
unlink.c NFS: Don't allow NFS silly-renamed files to be deleted, no signal 2013-03-14 11:29:42 -07:00
write.c NFS: put open context on error in nfs_flush_multi 2012-04-20 14:57:30 -04:00