diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-11-04 13:31:21 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-11-04 16:39:04 -0400 |
commit | 1788ea6e3b2a58cf4fb00206e362d9caff8d86a7 (patch) | |
tree | 24846fddf8b55f516f365a735defd79b6ea6d28a /include/linux | |
parent | 1583171492eb514e267c7b51e96846b38de0f544 (diff) |
nfs: when attempting to open a directory, fall back on normal lookup (try #5)
commit d953126 changed how nfs_atomic_lookup handles an -EISDIR return
from an OPEN call. Prior to that patch, that caused the client to fall
back to doing a normal lookup. When that patch went in, the code began
returning that error to userspace. The d_revalidate codepath however
never had the corresponding change, so it was still possible to end up
with a NULL ctx->state pointer after that.
That patch caused a regression. When we attempt to open a directory that
does not have a cached dentry, that open now errors out with EISDIR. If
you attempt the same open with a cached dentry, it will succeed.
Fix this by reverting the change in nfs_atomic_lookup and allowing
attempts to open directories to fall back to a normal lookup
Also, add a NFSv4-specific f_ops->open routine that just returns
-ENOTDIR. This should never be called if things are working properly,
but if it ever is, then the dprintk may help in debugging.
To facilitate this, a new file_operations field is also added to the
nfs_rpc_ops struct.
Cc: stable@kernel.org
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/nfs_fs.h | 3 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index ab2c6343361a..92ecf5585fac 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -410,6 +410,9 @@ extern const struct inode_operations nfs_file_inode_operations; | |||
410 | extern const struct inode_operations nfs3_file_inode_operations; | 410 | extern const struct inode_operations nfs3_file_inode_operations; |
411 | #endif /* CONFIG_NFS_V3 */ | 411 | #endif /* CONFIG_NFS_V3 */ |
412 | extern const struct file_operations nfs_file_operations; | 412 | extern const struct file_operations nfs_file_operations; |
413 | #ifdef CONFIG_NFS_V4 | ||
414 | extern const struct file_operations nfs4_file_operations; | ||
415 | #endif /* CONFIG_NFS_V4 */ | ||
413 | extern const struct address_space_operations nfs_file_aops; | 416 | extern const struct address_space_operations nfs_file_aops; |
414 | extern const struct address_space_operations nfs_dir_aops; | 417 | extern const struct address_space_operations nfs_dir_aops; |
415 | 418 | ||
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index c74595ba7094..2a7c533be5dd 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1192,6 +1192,7 @@ struct nfs_rpc_ops { | |||
1192 | const struct dentry_operations *dentry_ops; | 1192 | const struct dentry_operations *dentry_ops; |
1193 | const struct inode_operations *dir_inode_ops; | 1193 | const struct inode_operations *dir_inode_ops; |
1194 | const struct inode_operations *file_inode_ops; | 1194 | const struct inode_operations *file_inode_ops; |
1195 | const struct file_operations *file_ops; | ||
1195 | 1196 | ||
1196 | int (*getroot) (struct nfs_server *, struct nfs_fh *, | 1197 | int (*getroot) (struct nfs_server *, struct nfs_fh *, |
1197 | struct nfs_fsinfo *); | 1198 | struct nfs_fsinfo *); |