diff options
author | NeilBrown <neilb@suse.com> | 2015-07-30 13:00:56 +1000 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2015-09-28 10:21:38 +0100 |
commit | 93feb4de6765a78f9596aba5e2f4cc8deb01f09a (patch) | |
tree | 9bb3690bd432a530e81dccd83dfa94845a422149 | |
parent | 52b7c9cb1189a5b0a7f554ad4ce71b5e7dc68202 (diff) | |
download | linux-stable-93feb4de6765a78f9596aba5e2f4cc8deb01f09a.tar.gz linux-stable-93feb4de6765a78f9596aba5e2f4cc8deb01f09a.tar.bz2 linux-stable-93feb4de6765a78f9596aba5e2f4cc8deb01f09a.zip |
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>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index dd15268c003c..6cf18adda512 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2331,7 +2331,7 @@ static int _nfs4_do_open(struct inode *dir, goto err_free_label; state = ctx->state; - if ((opendata->o_arg.open_flags & O_EXCL) && + if ((opendata->o_arg.open_flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) && (opendata->o_arg.createmode != NFS4_CREATE_GUARDED)) { nfs4_exclusive_attrset(opendata, sattr); |