diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 23:16:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 23:16:07 -0500 |
commit | d895cb1af15c04c522a25c79cc429076987c089b (patch) | |
tree | 895dc9157e28f603d937a58be664e4e440d5530c /fs/nfs | |
parent | 9626357371b519f2b955fef399647181034a77fe (diff) | |
parent | d3d009cb965eae7e002ea5badf603ea8f4c34915 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile (part one) from Al Viro:
"Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent
locking violations, etc.
The most visible changes here are death of FS_REVAL_DOT (replaced with
"has ->d_weak_revalidate()") and a new helper getting from struct file
to inode. Some bits of preparation to xattr method interface changes.
Misc patches by various people sent this cycle *and* ocfs2 fixes from
several cycles ago that should've been upstream right then.
PS: the next vfs pile will be xattr stuff."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
saner proc_get_inode() calling conventions
proc: avoid extra pde_put() in proc_fill_super()
fs: change return values from -EACCES to -EPERM
fs/exec.c: make bprm_mm_init() static
ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
ocfs2: fix possible use-after-free with AIO
ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero
target: writev() on single-element vector is pointless
export kernel_write(), convert open-coded instances
fs: encode_fh: return FILEID_INVALID if invalid fid_type
kill f_vfsmnt
vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
nfsd: handle vfs_getattr errors in acl protocol
switch vfs_getattr() to struct path
default SET_PERSONALITY() in linux/elf.h
ceph: prepopulate inodes only when request is aborted
d_hash_and_lookup(): export, switch open-coded instances
9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
9p: split dropping the acls from v9fs_set_create_acl()
...
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/dir.c | 48 | ||||
-rw-r--r-- | fs/nfs/file.c | 2 | ||||
-rw-r--r-- | fs/nfs/idmap.c | 2 | ||||
-rw-r--r-- | fs/nfs/inode.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs3proc.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4file.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4super.c | 6 | ||||
-rw-r--r-- | fs/nfs/proc.c | 2 | ||||
-rw-r--r-- | fs/nfs/super.c | 6 |
9 files changed, 57 insertions, 17 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 1b2d7eb93796..f23f455be42b 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -281,7 +281,7 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des | |||
281 | 281 | ||
282 | for (i = 0; i < array->size; i++) { | 282 | for (i = 0; i < array->size; i++) { |
283 | if (array->array[i].cookie == *desc->dir_cookie) { | 283 | if (array->array[i].cookie == *desc->dir_cookie) { |
284 | struct nfs_inode *nfsi = NFS_I(desc->file->f_path.dentry->d_inode); | 284 | struct nfs_inode *nfsi = NFS_I(file_inode(desc->file)); |
285 | struct nfs_open_dir_context *ctx = desc->file->private_data; | 285 | struct nfs_open_dir_context *ctx = desc->file->private_data; |
286 | 286 | ||
287 | new_pos = desc->current_index + i; | 287 | new_pos = desc->current_index + i; |
@@ -629,7 +629,7 @@ out: | |||
629 | static | 629 | static |
630 | int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) | 630 | int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) |
631 | { | 631 | { |
632 | struct inode *inode = desc->file->f_path.dentry->d_inode; | 632 | struct inode *inode = file_inode(desc->file); |
633 | int ret; | 633 | int ret; |
634 | 634 | ||
635 | ret = nfs_readdir_xdr_to_array(desc, page, inode); | 635 | ret = nfs_readdir_xdr_to_array(desc, page, inode); |
@@ -660,7 +660,7 @@ void cache_page_release(nfs_readdir_descriptor_t *desc) | |||
660 | static | 660 | static |
661 | struct page *get_cache_page(nfs_readdir_descriptor_t *desc) | 661 | struct page *get_cache_page(nfs_readdir_descriptor_t *desc) |
662 | { | 662 | { |
663 | return read_cache_page(desc->file->f_path.dentry->d_inode->i_mapping, | 663 | return read_cache_page(file_inode(desc->file)->i_mapping, |
664 | desc->page_index, (filler_t *)nfs_readdir_filler, desc); | 664 | desc->page_index, (filler_t *)nfs_readdir_filler, desc); |
665 | } | 665 | } |
666 | 666 | ||
@@ -764,7 +764,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
764 | { | 764 | { |
765 | struct page *page = NULL; | 765 | struct page *page = NULL; |
766 | int status; | 766 | int status; |
767 | struct inode *inode = desc->file->f_path.dentry->d_inode; | 767 | struct inode *inode = file_inode(desc->file); |
768 | struct nfs_open_dir_context *ctx = desc->file->private_data; | 768 | struct nfs_open_dir_context *ctx = desc->file->private_data; |
769 | 769 | ||
770 | dfprintk(DIRCACHE, "NFS: uncached_readdir() searching for cookie %Lu\n", | 770 | dfprintk(DIRCACHE, "NFS: uncached_readdir() searching for cookie %Lu\n", |
@@ -1136,6 +1136,45 @@ out_error: | |||
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | /* | 1138 | /* |
1139 | * A weaker form of d_revalidate for revalidating just the dentry->d_inode | ||
1140 | * when we don't really care about the dentry name. This is called when a | ||
1141 | * pathwalk ends on a dentry that was not found via a normal lookup in the | ||
1142 | * parent dir (e.g.: ".", "..", procfs symlinks or mountpoint traversals). | ||
1143 | * | ||
1144 | * In this situation, we just want to verify that the inode itself is OK | ||
1145 | * since the dentry might have changed on the server. | ||
1146 | */ | ||
1147 | static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags) | ||
1148 | { | ||
1149 | int error; | ||
1150 | struct inode *inode = dentry->d_inode; | ||
1151 | |||
1152 | /* | ||
1153 | * I believe we can only get a negative dentry here in the case of a | ||
1154 | * procfs-style symlink. Just assume it's correct for now, but we may | ||
1155 | * eventually need to do something more here. | ||
1156 | */ | ||
1157 | if (!inode) { | ||
1158 | dfprintk(LOOKUPCACHE, "%s: %s/%s has negative inode\n", | ||
1159 | __func__, dentry->d_parent->d_name.name, | ||
1160 | dentry->d_name.name); | ||
1161 | return 1; | ||
1162 | } | ||
1163 | |||
1164 | if (is_bad_inode(inode)) { | ||
1165 | dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n", | ||
1166 | __func__, dentry->d_parent->d_name.name, | ||
1167 | dentry->d_name.name); | ||
1168 | return 0; | ||
1169 | } | ||
1170 | |||
1171 | error = nfs_revalidate_inode(NFS_SERVER(inode), inode); | ||
1172 | dfprintk(LOOKUPCACHE, "NFS: %s: inode %lu is %s\n", | ||
1173 | __func__, inode->i_ino, error ? "invalid" : "valid"); | ||
1174 | return !error; | ||
1175 | } | ||
1176 | |||
1177 | /* | ||
1139 | * This is called from dput() when d_count is going to 0. | 1178 | * This is called from dput() when d_count is going to 0. |
1140 | */ | 1179 | */ |
1141 | static int nfs_dentry_delete(const struct dentry *dentry) | 1180 | static int nfs_dentry_delete(const struct dentry *dentry) |
@@ -1202,6 +1241,7 @@ static void nfs_d_release(struct dentry *dentry) | |||
1202 | 1241 | ||
1203 | const struct dentry_operations nfs_dentry_operations = { | 1242 | const struct dentry_operations nfs_dentry_operations = { |
1204 | .d_revalidate = nfs_lookup_revalidate, | 1243 | .d_revalidate = nfs_lookup_revalidate, |
1244 | .d_weak_revalidate = nfs_weak_revalidate, | ||
1205 | .d_delete = nfs_dentry_delete, | 1245 | .d_delete = nfs_dentry_delete, |
1206 | .d_iput = nfs_dentry_iput, | 1246 | .d_iput = nfs_dentry_iput, |
1207 | .d_automount = nfs_d_automount, | 1247 | .d_automount = nfs_d_automount, |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 3c2b893665ba..29f4a48a0ee6 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -292,7 +292,7 @@ static int | |||
292 | nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 292 | nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
293 | { | 293 | { |
294 | int ret; | 294 | int ret; |
295 | struct inode *inode = file->f_path.dentry->d_inode; | 295 | struct inode *inode = file_inode(file); |
296 | 296 | ||
297 | do { | 297 | do { |
298 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 298 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index b9623d19d599..dc0f98dfa717 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -765,7 +765,7 @@ out: | |||
765 | static ssize_t | 765 | static ssize_t |
766 | idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | 766 | idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) |
767 | { | 767 | { |
768 | struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); | 768 | struct rpc_inode *rpci = RPC_I(file_inode(filp)); |
769 | struct idmap *idmap = (struct idmap *)rpci->private; | 769 | struct idmap *idmap = (struct idmap *)rpci->private; |
770 | struct key_construction *cons; | 770 | struct key_construction *cons; |
771 | struct idmap_msg im; | 771 | struct idmap_msg im; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 468ba8bf0f56..b586fe9af475 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -711,7 +711,7 @@ EXPORT_SYMBOL_GPL(put_nfs_open_context); | |||
711 | */ | 711 | */ |
712 | void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) | 712 | void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) |
713 | { | 713 | { |
714 | struct inode *inode = filp->f_path.dentry->d_inode; | 714 | struct inode *inode = file_inode(filp); |
715 | struct nfs_inode *nfsi = NFS_I(inode); | 715 | struct nfs_inode *nfsi = NFS_I(inode); |
716 | 716 | ||
717 | filp->private_data = get_nfs_open_context(ctx); | 717 | filp->private_data = get_nfs_open_context(ctx); |
@@ -744,7 +744,7 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c | |||
744 | 744 | ||
745 | static void nfs_file_clear_open_context(struct file *filp) | 745 | static void nfs_file_clear_open_context(struct file *filp) |
746 | { | 746 | { |
747 | struct inode *inode = filp->f_path.dentry->d_inode; | 747 | struct inode *inode = file_inode(filp); |
748 | struct nfs_open_context *ctx = nfs_file_open_context(filp); | 748 | struct nfs_open_context *ctx = nfs_file_open_context(filp); |
749 | 749 | ||
750 | if (ctx) { | 750 | if (ctx) { |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 70efb63b1e42..43ea96ced28c 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -872,7 +872,7 @@ static void nfs3_proc_commit_setup(struct nfs_commit_data *data, struct rpc_mess | |||
872 | static int | 872 | static int |
873 | nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl) | 873 | nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl) |
874 | { | 874 | { |
875 | struct inode *inode = filp->f_path.dentry->d_inode; | 875 | struct inode *inode = file_inode(filp); |
876 | 876 | ||
877 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); | 877 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); |
878 | } | 878 | } |
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 08ddcccb8887..13e6bb3e3fe5 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
@@ -94,7 +94,7 @@ static int | |||
94 | nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 94 | nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
95 | { | 95 | { |
96 | int ret; | 96 | int ret; |
97 | struct inode *inode = file->f_path.dentry->d_inode; | 97 | struct inode *inode = file_inode(file); |
98 | 98 | ||
99 | do { | 99 | do { |
100 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 100 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index 84d2e9e2f313..569b166cc050 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c | |||
@@ -28,7 +28,7 @@ static struct file_system_type nfs4_remote_fs_type = { | |||
28 | .name = "nfs4", | 28 | .name = "nfs4", |
29 | .mount = nfs4_remote_mount, | 29 | .mount = nfs4_remote_mount, |
30 | .kill_sb = nfs_kill_super, | 30 | .kill_sb = nfs_kill_super, |
31 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 31 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static struct file_system_type nfs4_remote_referral_fs_type = { | 34 | static struct file_system_type nfs4_remote_referral_fs_type = { |
@@ -36,7 +36,7 @@ static struct file_system_type nfs4_remote_referral_fs_type = { | |||
36 | .name = "nfs4", | 36 | .name = "nfs4", |
37 | .mount = nfs4_remote_referral_mount, | 37 | .mount = nfs4_remote_referral_mount, |
38 | .kill_sb = nfs_kill_super, | 38 | .kill_sb = nfs_kill_super, |
39 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 39 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct file_system_type nfs4_referral_fs_type = { | 42 | struct file_system_type nfs4_referral_fs_type = { |
@@ -44,7 +44,7 @@ struct file_system_type nfs4_referral_fs_type = { | |||
44 | .name = "nfs4", | 44 | .name = "nfs4", |
45 | .mount = nfs4_referral_mount, | 45 | .mount = nfs4_referral_mount, |
46 | .kill_sb = nfs_kill_super, | 46 | .kill_sb = nfs_kill_super, |
47 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 47 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static const struct super_operations nfs4_sops = { | 50 | static const struct super_operations nfs4_sops = { |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index f084dac948e1..fc8de9016acf 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -662,7 +662,7 @@ nfs_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg) | |||
662 | static int | 662 | static int |
663 | nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl) | 663 | nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl) |
664 | { | 664 | { |
665 | struct inode *inode = filp->f_path.dentry->d_inode; | 665 | struct inode *inode = file_inode(filp); |
666 | 666 | ||
667 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); | 667 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); |
668 | } | 668 | } |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index befbae0cce41..a9dc5fc29955 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -291,7 +291,7 @@ struct file_system_type nfs_fs_type = { | |||
291 | .name = "nfs", | 291 | .name = "nfs", |
292 | .mount = nfs_fs_mount, | 292 | .mount = nfs_fs_mount, |
293 | .kill_sb = nfs_kill_super, | 293 | .kill_sb = nfs_kill_super, |
294 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 294 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
295 | }; | 295 | }; |
296 | EXPORT_SYMBOL_GPL(nfs_fs_type); | 296 | EXPORT_SYMBOL_GPL(nfs_fs_type); |
297 | 297 | ||
@@ -300,7 +300,7 @@ struct file_system_type nfs_xdev_fs_type = { | |||
300 | .name = "nfs", | 300 | .name = "nfs", |
301 | .mount = nfs_xdev_mount, | 301 | .mount = nfs_xdev_mount, |
302 | .kill_sb = nfs_kill_super, | 302 | .kill_sb = nfs_kill_super, |
303 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 303 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
304 | }; | 304 | }; |
305 | 305 | ||
306 | const struct super_operations nfs_sops = { | 306 | const struct super_operations nfs_sops = { |
@@ -330,7 +330,7 @@ struct file_system_type nfs4_fs_type = { | |||
330 | .name = "nfs4", | 330 | .name = "nfs4", |
331 | .mount = nfs_fs_mount, | 331 | .mount = nfs_fs_mount, |
332 | .kill_sb = nfs_kill_super, | 332 | .kill_sb = nfs_kill_super, |
333 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 333 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
334 | }; | 334 | }; |
335 | EXPORT_SYMBOL_GPL(nfs4_fs_type); | 335 | EXPORT_SYMBOL_GPL(nfs4_fs_type); |
336 | 336 | ||