android_kernel_google_msm/fs/nfs
NeilBrown f11d9b18aa NFSv4: don't set SETATTR for O_RDONLY|O_EXCL
commit efcbc04e16dfa95fef76309f89710dd1d99a5453 upstream.

It is unusual to combine the open flags O_RDONLY and O_EXCL, but
it appears that libre-office does just that.

[pid  3250] stat("/home/USER/.config", {st_mode=S_IFDIR|0700, st_size=8192, ...}) = 0
[pid  3250] open("/home/USER/.config/libreoffice/4-suse/user/extensions/buildid", O_RDONLY|O_EXCL <unfinished ...>

NFSv4 takes O_EXCL as a sign that a setattr command should be sent,
probably to reset the timestamps.

When it was an O_RDONLY open, the SETATTR command does not
identify any actual attributes to change.
If no delegation was provided to the open, the SETATTR uses the
all-zeros stateid and the request is accepted (at least by the
Linux NFS server - no harm, no foul).

If a read-delegation was provided, this is used in the SETATTR
request, and a Netapp filer will justifiably claim
NFS4ERR_BAD_STATEID, which the Linux client takes as a sign
to retry - indefinitely.

So only treat O_EXCL specially if O_CREAT was also given.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
2016-04-27 18:55:15 +08:00
..
blocklayout nfs: fix do_div() warning by instead using sector_div() 2013-12-20 07:34:20 -08:00
objlayout
cache_lib.c
cache_lib.h
callback.c nfs: fix high load average due to callback thread sleeping 2015-09-18 09:20:32 +08:00
callback.h
callback_proc.c
callback_xdr.c NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args 2015-06-19 11:40:14 +08:00
client.c
delegation.c NFSv4: Don't call put_rpccred() under the rcu_read_lock() 2015-06-19 11:40:20 +08:00
delegation.h
dir.c
direct.c
dns_resolve.c
dns_resolve.h
file.c
fscache-index.c
fscache.c
fscache.h
getroot.c move d_rcu from overlapping d_child to overlapping d_alias 2015-04-14 17:33:58 +08:00
idmap.c
inode.c nfs: Fix use of uninitialized variable in nfs_getattr() 2015-02-02 17:05:19 +08:00
internal.h
iostat.h
Kconfig
Makefile
mount_clnt.c
namespace.c
netns.h
nfs2xdr.c
nfs3acl.c
nfs3proc.c
nfs3xdr.c NFS: Fix size of NFSACL SETACL operations 2015-10-22 09:20:03 +08:00
nfs4_fs.h
nfs4filelayout.c
nfs4filelayout.h
nfs4filelayoutdev.c
nfs4namespace.c
nfs4proc.c NFSv4: don't set SETATTR for O_RDONLY|O_EXCL 2016-04-27 18:55:15 +08:00
nfs4renewd.c NFSv4.1: Fix an NFSv4.1 state renewal regression 2015-02-02 17:04:46 +08:00
nfs4state.c Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount 2015-10-22 09:20:08 +08:00
nfs4xdr.c NFSv4: OPEN must handle the NFS4ERR_IO return code correctly 2014-02-13 11:51:12 -08:00
nfsroot.c
pagelist.c
pnfs.c NFSv4.1: Fix a race in pNFS layoutcommit 2014-06-07 16:02:05 -07:00
pnfs.h
pnfs_dev.c
proc.c
read.c
super.c
symlink.c
sysctl.c
unlink.c
write.c nfs: tear down caches in nfs_init_writepagecache when allocation fails 2014-02-20 10:45:33 -08:00