aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-03-17 18:25:59 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-15 15:06:57 -0400
commit2b0143b5c986be1ce8408b3aadc4709e0a94429d (patch)
tree98b1dee70f3d5d9ac9309f4638e41864ddcd0952 /fs/fuse/dir.c
parentce0b16ddf18df35026164fda4a642ef10c01f442 (diff)
VFS: normal filesystems (and lustre): d_inode() annotations
that's the bulk of filesystem drivers dealing with inodes of their own Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r--fs/fuse/dir.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 1545b711ddcf..0572bca49f15 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -192,7 +192,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
192 struct fuse_inode *fi; 192 struct fuse_inode *fi;
193 int ret; 193 int ret;
194 194
195 inode = ACCESS_ONCE(entry->d_inode); 195 inode = d_inode_rcu(entry);
196 if (inode && is_bad_inode(inode)) 196 if (inode && is_bad_inode(inode))
197 goto invalid; 197 goto invalid;
198 else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || 198 else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
@@ -220,7 +220,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
220 attr_version = fuse_get_attr_version(fc); 220 attr_version = fuse_get_attr_version(fc);
221 221
222 parent = dget_parent(entry); 222 parent = dget_parent(entry);
223 fuse_lookup_init(fc, &args, get_node_id(parent->d_inode), 223 fuse_lookup_init(fc, &args, get_node_id(d_inode(parent)),
224 &entry->d_name, &outarg); 224 &entry->d_name, &outarg);
225 ret = fuse_simple_request(fc, &args); 225 ret = fuse_simple_request(fc, &args);
226 dput(parent); 226 dput(parent);
@@ -254,7 +254,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
254 return -ECHILD; 254 return -ECHILD;
255 } else if (test_and_clear_bit(FUSE_I_INIT_RDPLUS, &fi->state)) { 255 } else if (test_and_clear_bit(FUSE_I_INIT_RDPLUS, &fi->state)) {
256 parent = dget_parent(entry); 256 parent = dget_parent(entry);
257 fuse_advise_use_readdirplus(parent->d_inode); 257 fuse_advise_use_readdirplus(d_inode(parent));
258 dput(parent); 258 dput(parent);
259 } 259 }
260 } 260 }
@@ -487,7 +487,7 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
487 entry = res; 487 entry = res;
488 } 488 }
489 489
490 if (!(flags & O_CREAT) || entry->d_inode) 490 if (!(flags & O_CREAT) || d_really_is_positive(entry))
491 goto no_open; 491 goto no_open;
492 492
493 /* Only creates */ 493 /* Only creates */
@@ -653,7 +653,7 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
653 args.in.args[0].value = entry->d_name.name; 653 args.in.args[0].value = entry->d_name.name;
654 err = fuse_simple_request(fc, &args); 654 err = fuse_simple_request(fc, &args);
655 if (!err) { 655 if (!err) {
656 struct inode *inode = entry->d_inode; 656 struct inode *inode = d_inode(entry);
657 struct fuse_inode *fi = get_fuse_inode(inode); 657 struct fuse_inode *fi = get_fuse_inode(inode);
658 658
659 spin_lock(&fc->lock); 659 spin_lock(&fc->lock);
@@ -689,7 +689,7 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
689 args.in.args[0].value = entry->d_name.name; 689 args.in.args[0].value = entry->d_name.name;
690 err = fuse_simple_request(fc, &args); 690 err = fuse_simple_request(fc, &args);
691 if (!err) { 691 if (!err) {
692 clear_nlink(entry->d_inode); 692 clear_nlink(d_inode(entry));
693 fuse_invalidate_attr(dir); 693 fuse_invalidate_attr(dir);
694 fuse_invalidate_entry_cache(entry); 694 fuse_invalidate_entry_cache(entry);
695 } else if (err == -EINTR) 695 } else if (err == -EINTR)
@@ -721,12 +721,12 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
721 err = fuse_simple_request(fc, &args); 721 err = fuse_simple_request(fc, &args);
722 if (!err) { 722 if (!err) {
723 /* ctime changes */ 723 /* ctime changes */
724 fuse_invalidate_attr(oldent->d_inode); 724 fuse_invalidate_attr(d_inode(oldent));
725 fuse_update_ctime(oldent->d_inode); 725 fuse_update_ctime(d_inode(oldent));
726 726
727 if (flags & RENAME_EXCHANGE) { 727 if (flags & RENAME_EXCHANGE) {
728 fuse_invalidate_attr(newent->d_inode); 728 fuse_invalidate_attr(d_inode(newent));
729 fuse_update_ctime(newent->d_inode); 729 fuse_update_ctime(d_inode(newent));
730 } 730 }
731 731
732 fuse_invalidate_attr(olddir); 732 fuse_invalidate_attr(olddir);
@@ -734,10 +734,10 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
734 fuse_invalidate_attr(newdir); 734 fuse_invalidate_attr(newdir);
735 735
736 /* newent will end up negative */ 736 /* newent will end up negative */
737 if (!(flags & RENAME_EXCHANGE) && newent->d_inode) { 737 if (!(flags & RENAME_EXCHANGE) && d_really_is_positive(newent)) {
738 fuse_invalidate_attr(newent->d_inode); 738 fuse_invalidate_attr(d_inode(newent));
739 fuse_invalidate_entry_cache(newent); 739 fuse_invalidate_entry_cache(newent);
740 fuse_update_ctime(newent->d_inode); 740 fuse_update_ctime(d_inode(newent));
741 } 741 }
742 } else if (err == -EINTR) { 742 } else if (err == -EINTR) {
743 /* If request was interrupted, DEITY only knows if the 743 /* If request was interrupted, DEITY only knows if the
@@ -746,7 +746,7 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
746 directory), then there can be inconsistency between 746 directory), then there can be inconsistency between
747 the dcache and the real filesystem. Tough luck. */ 747 the dcache and the real filesystem. Tough luck. */
748 fuse_invalidate_entry(oldent); 748 fuse_invalidate_entry(oldent);
749 if (newent->d_inode) 749 if (d_really_is_positive(newent))
750 fuse_invalidate_entry(newent); 750 fuse_invalidate_entry(newent);
751 } 751 }
752 752
@@ -788,7 +788,7 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
788{ 788{
789 int err; 789 int err;
790 struct fuse_link_in inarg; 790 struct fuse_link_in inarg;
791 struct inode *inode = entry->d_inode; 791 struct inode *inode = d_inode(entry);
792 struct fuse_conn *fc = get_fuse_conn(inode); 792 struct fuse_conn *fc = get_fuse_conn(inode);
793 FUSE_ARGS(args); 793 FUSE_ARGS(args);
794 794
@@ -961,9 +961,9 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
961 fuse_invalidate_attr(parent); 961 fuse_invalidate_attr(parent);
962 fuse_invalidate_entry(entry); 962 fuse_invalidate_entry(entry);
963 963
964 if (child_nodeid != 0 && entry->d_inode) { 964 if (child_nodeid != 0 && d_really_is_positive(entry)) {
965 mutex_lock(&entry->d_inode->i_mutex); 965 mutex_lock(&d_inode(entry)->i_mutex);
966 if (get_node_id(entry->d_inode) != child_nodeid) { 966 if (get_node_id(d_inode(entry)) != child_nodeid) {
967 err = -ENOENT; 967 err = -ENOENT;
968 goto badentry; 968 goto badentry;
969 } 969 }
@@ -977,13 +977,13 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
977 err = -ENOTEMPTY; 977 err = -ENOTEMPTY;
978 goto badentry; 978 goto badentry;
979 } 979 }
980 entry->d_inode->i_flags |= S_DEAD; 980 d_inode(entry)->i_flags |= S_DEAD;
981 } 981 }
982 dont_mount(entry); 982 dont_mount(entry);
983 clear_nlink(entry->d_inode); 983 clear_nlink(d_inode(entry));
984 err = 0; 984 err = 0;
985 badentry: 985 badentry:
986 mutex_unlock(&entry->d_inode->i_mutex); 986 mutex_unlock(&d_inode(entry)->i_mutex);
987 if (!err) 987 if (!err)
988 d_delete(entry); 988 d_delete(entry);
989 } else { 989 } else {
@@ -1169,7 +1169,7 @@ static int fuse_direntplus_link(struct file *file,
1169 struct qstr name = QSTR_INIT(dirent->name, dirent->namelen); 1169 struct qstr name = QSTR_INIT(dirent->name, dirent->namelen);
1170 struct dentry *dentry; 1170 struct dentry *dentry;
1171 struct dentry *alias; 1171 struct dentry *alias;
1172 struct inode *dir = parent->d_inode; 1172 struct inode *dir = d_inode(parent);
1173 struct fuse_conn *fc; 1173 struct fuse_conn *fc;
1174 struct inode *inode; 1174 struct inode *inode;
1175 1175
@@ -1205,7 +1205,7 @@ static int fuse_direntplus_link(struct file *file,
1205 name.hash = full_name_hash(name.name, name.len); 1205 name.hash = full_name_hash(name.name, name.len);
1206 dentry = d_lookup(parent, &name); 1206 dentry = d_lookup(parent, &name);
1207 if (dentry) { 1207 if (dentry) {
1208 inode = dentry->d_inode; 1208 inode = d_inode(dentry);
1209 if (!inode) { 1209 if (!inode) {
1210 d_drop(dentry); 1210 d_drop(dentry);
1211 } else if (get_node_id(inode) != o->nodeid || 1211 } else if (get_node_id(inode) != o->nodeid ||
@@ -1367,7 +1367,7 @@ static int fuse_readdir(struct file *file, struct dir_context *ctx)
1367 1367
1368static char *read_link(struct dentry *dentry) 1368static char *read_link(struct dentry *dentry)
1369{ 1369{
1370 struct inode *inode = dentry->d_inode; 1370 struct inode *inode = d_inode(dentry);
1371 struct fuse_conn *fc = get_fuse_conn(inode); 1371 struct fuse_conn *fc = get_fuse_conn(inode);
1372 FUSE_ARGS(args); 1372 FUSE_ARGS(args);
1373 char *link; 1373 char *link;
@@ -1712,7 +1712,7 @@ error:
1712 1712
1713static int fuse_setattr(struct dentry *entry, struct iattr *attr) 1713static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1714{ 1714{
1715 struct inode *inode = entry->d_inode; 1715 struct inode *inode = d_inode(entry);
1716 1716
1717 if (!fuse_allow_current_process(get_fuse_conn(inode))) 1717 if (!fuse_allow_current_process(get_fuse_conn(inode)))
1718 return -EACCES; 1718 return -EACCES;
@@ -1726,7 +1726,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1726static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, 1726static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1727 struct kstat *stat) 1727 struct kstat *stat)
1728{ 1728{
1729 struct inode *inode = entry->d_inode; 1729 struct inode *inode = d_inode(entry);
1730 struct fuse_conn *fc = get_fuse_conn(inode); 1730 struct fuse_conn *fc = get_fuse_conn(inode);
1731 1731
1732 if (!fuse_allow_current_process(fc)) 1732 if (!fuse_allow_current_process(fc))
@@ -1738,7 +1738,7 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1738static int fuse_setxattr(struct dentry *entry, const char *name, 1738static int fuse_setxattr(struct dentry *entry, const char *name,
1739 const void *value, size_t size, int flags) 1739 const void *value, size_t size, int flags)
1740{ 1740{
1741 struct inode *inode = entry->d_inode; 1741 struct inode *inode = d_inode(entry);
1742 struct fuse_conn *fc = get_fuse_conn(inode); 1742 struct fuse_conn *fc = get_fuse_conn(inode);
1743 FUSE_ARGS(args); 1743 FUSE_ARGS(args);
1744 struct fuse_setxattr_in inarg; 1744 struct fuse_setxattr_in inarg;
@@ -1774,7 +1774,7 @@ static int fuse_setxattr(struct dentry *entry, const char *name,
1774static ssize_t fuse_getxattr(struct dentry *entry, const char *name, 1774static ssize_t fuse_getxattr(struct dentry *entry, const char *name,
1775 void *value, size_t size) 1775 void *value, size_t size)
1776{ 1776{
1777 struct inode *inode = entry->d_inode; 1777 struct inode *inode = d_inode(entry);
1778 struct fuse_conn *fc = get_fuse_conn(inode); 1778 struct fuse_conn *fc = get_fuse_conn(inode);
1779 FUSE_ARGS(args); 1779 FUSE_ARGS(args);
1780 struct fuse_getxattr_in inarg; 1780 struct fuse_getxattr_in inarg;
@@ -1815,7 +1815,7 @@ static ssize_t fuse_getxattr(struct dentry *entry, const char *name,
1815 1815
1816static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) 1816static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
1817{ 1817{
1818 struct inode *inode = entry->d_inode; 1818 struct inode *inode = d_inode(entry);
1819 struct fuse_conn *fc = get_fuse_conn(inode); 1819 struct fuse_conn *fc = get_fuse_conn(inode);
1820 FUSE_ARGS(args); 1820 FUSE_ARGS(args);
1821 struct fuse_getxattr_in inarg; 1821 struct fuse_getxattr_in inarg;
@@ -1857,7 +1857,7 @@ static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
1857 1857
1858static int fuse_removexattr(struct dentry *entry, const char *name) 1858static int fuse_removexattr(struct dentry *entry, const char *name)
1859{ 1859{
1860 struct inode *inode = entry->d_inode; 1860 struct inode *inode = d_inode(entry);
1861 struct fuse_conn *fc = get_fuse_conn(inode); 1861 struct fuse_conn *fc = get_fuse_conn(inode);
1862 FUSE_ARGS(args); 1862 FUSE_ARGS(args);
1863 int err; 1863 int err;