]> git.baikalelectronics.ru Git - kernel.git/commit
Open with O_CREAT flag set fails to open existing files on non writable directories
authorSachin Prabhu <sprabhu@redhat.com>
Wed, 20 Apr 2011 12:09:35 +0000 (13:09 +0100)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 20 Apr 2011 15:03:01 +0000 (11:03 -0400)
commit538a65ef9076a97f1eede18c86c214d26a66e21b
tree0721b1775b9a99ed5481e8a47383f6f49b50f64a
parenta0b909e64f77538ef46cb4ae9a98481c47ca3eea
Open with O_CREAT flag set fails to open existing files on non writable directories

An open on a NFS4 share using the O_CREAT flag on an existing file for
which we have permissions to open but contained in a directory with no
write permissions will fail with EACCES.

A tcpdump shows that the client had set the open mode to UNCHECKED which
indicates that the file should be created if it doesn't exist and
encountering an existing flag is not an error. Since in this case the
file exists and can be opened by the user, the NFS server is wrong in
attempting to check create permissions on the parent directory.

The patch adds a conditional statement to check for create permissions
only if the file doesn't exist.

Signed-off-by: Sachin S. Prabhu <sprabhu@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/vfs.c