NFS: Fix another OPEN_DOWNGRADE bug
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 25 Jun 2016 23:19:28 +0000 (19:19 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 28 Jun 2016 20:55:34 +0000 (16:55 -0400)
commite547f2628327fec6afd2e03b46f113f614cca05b
tree9daba7ada0d5a10f7fdf1828f38954d86253dcc1
parentd20cb71dbf3487f24549ede1a8e2d67579b4632e
NFS: Fix another OPEN_DOWNGRADE bug

Olga Kornievskaia reports that the following test fails to trigger
an OPEN_DOWNGRADE on the wire, and only triggers the final CLOSE.

fd0 = open(foo, RDRW)   -- should be open on the wire for "both"
fd1 = open(foo, RDONLY)  -- should be open on the wire for "read"
close(fd0) -- should trigger an open_downgrade
read(fd1)
close(fd1)

The issue is that we're missing a check for whether or not the current
state transitioned from an O_RDWR state as opposed to having transitioned
from a combination of O_RDONLY and O_WRONLY.

Reported-by: Olga Kornievskaia <aglo@umich.edu>
Fixes: cd9288ffaea4 ("NFSv4: Fix another bug in the close/open_downgrade code")
Cc: stable@vger.kernel.org # 2.6.33+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs4proc.c