aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs
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/configfs
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/configfs')
-rw-r--r--fs/configfs/dir.c70
-rw-r--r--fs/configfs/file.c4
-rw-r--r--fs/configfs/inode.c16
3 files changed, 45 insertions, 45 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index acb3d63bc9dc..c81ce7f200a6 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -289,7 +289,7 @@ static int configfs_create_dir(struct config_item *item, struct dentry *dentry)
289 configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata); 289 configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata);
290 error = configfs_create(dentry, mode, init_dir); 290 error = configfs_create(dentry, mode, init_dir);
291 if (!error) { 291 if (!error) {
292 inc_nlink(p->d_inode); 292 inc_nlink(d_inode(p));
293 item->ci_dentry = dentry; 293 item->ci_dentry = dentry;
294 } else { 294 } else {
295 struct configfs_dirent *sd = dentry->d_fsdata; 295 struct configfs_dirent *sd = dentry->d_fsdata;
@@ -375,8 +375,8 @@ static void remove_dir(struct dentry * d)
375 list_del_init(&sd->s_sibling); 375 list_del_init(&sd->s_sibling);
376 spin_unlock(&configfs_dirent_lock); 376 spin_unlock(&configfs_dirent_lock);
377 configfs_put(sd); 377 configfs_put(sd);
378 if (d->d_inode) 378 if (d_really_is_positive(d))
379 simple_rmdir(parent->d_inode,d); 379 simple_rmdir(d_inode(parent),d);
380 380
381 pr_debug(" o %pd removing done (%d)\n", d, d_count(d)); 381 pr_debug(" o %pd removing done (%d)\n", d, d_count(d));
382 382
@@ -513,7 +513,7 @@ static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex
513 /* Abort if racing with mkdir() */ 513 /* Abort if racing with mkdir() */
514 if (sd->s_type & CONFIGFS_USET_IN_MKDIR) { 514 if (sd->s_type & CONFIGFS_USET_IN_MKDIR) {
515 if (wait_mutex) 515 if (wait_mutex)
516 *wait_mutex = &sd->s_dentry->d_inode->i_mutex; 516 *wait_mutex = &d_inode(sd->s_dentry)->i_mutex;
517 return -EAGAIN; 517 return -EAGAIN;
518 } 518 }
519 519
@@ -624,13 +624,13 @@ static void detach_groups(struct config_group *group)
624 624
625 child = sd->s_dentry; 625 child = sd->s_dentry;
626 626
627 mutex_lock(&child->d_inode->i_mutex); 627 mutex_lock(&d_inode(child)->i_mutex);
628 628
629 configfs_detach_group(sd->s_element); 629 configfs_detach_group(sd->s_element);
630 child->d_inode->i_flags |= S_DEAD; 630 d_inode(child)->i_flags |= S_DEAD;
631 dont_mount(child); 631 dont_mount(child);
632 632
633 mutex_unlock(&child->d_inode->i_mutex); 633 mutex_unlock(&d_inode(child)->i_mutex);
634 634
635 d_delete(child); 635 d_delete(child);
636 dput(child); 636 dput(child);
@@ -672,7 +672,7 @@ static int create_default_group(struct config_group *parent_group,
672 sd = child->d_fsdata; 672 sd = child->d_fsdata;
673 sd->s_type |= CONFIGFS_USET_DEFAULT; 673 sd->s_type |= CONFIGFS_USET_DEFAULT;
674 } else { 674 } else {
675 BUG_ON(child->d_inode); 675 BUG_ON(d_inode(child));
676 d_drop(child); 676 d_drop(child);
677 dput(child); 677 dput(child);
678 } 678 }
@@ -818,11 +818,11 @@ static int configfs_attach_item(struct config_item *parent_item,
818 * the VFS may already have hit and used them. Thus, 818 * the VFS may already have hit and used them. Thus,
819 * we must lock them as rmdir() would. 819 * we must lock them as rmdir() would.
820 */ 820 */
821 mutex_lock(&dentry->d_inode->i_mutex); 821 mutex_lock(&d_inode(dentry)->i_mutex);
822 configfs_remove_dir(item); 822 configfs_remove_dir(item);
823 dentry->d_inode->i_flags |= S_DEAD; 823 d_inode(dentry)->i_flags |= S_DEAD;
824 dont_mount(dentry); 824 dont_mount(dentry);
825 mutex_unlock(&dentry->d_inode->i_mutex); 825 mutex_unlock(&d_inode(dentry)->i_mutex);
826 d_delete(dentry); 826 d_delete(dentry);
827 } 827 }
828 } 828 }
@@ -858,16 +858,16 @@ static int configfs_attach_group(struct config_item *parent_item,
858 * We must also lock the inode to remove it safely in case of 858 * We must also lock the inode to remove it safely in case of
859 * error, as rmdir() would. 859 * error, as rmdir() would.
860 */ 860 */
861 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 861 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD);
862 configfs_adjust_dir_dirent_depth_before_populate(sd); 862 configfs_adjust_dir_dirent_depth_before_populate(sd);
863 ret = populate_groups(to_config_group(item)); 863 ret = populate_groups(to_config_group(item));
864 if (ret) { 864 if (ret) {
865 configfs_detach_item(item); 865 configfs_detach_item(item);
866 dentry->d_inode->i_flags |= S_DEAD; 866 d_inode(dentry)->i_flags |= S_DEAD;
867 dont_mount(dentry); 867 dont_mount(dentry);
868 } 868 }
869 configfs_adjust_dir_dirent_depth_after_populate(sd); 869 configfs_adjust_dir_dirent_depth_after_populate(sd);
870 mutex_unlock(&dentry->d_inode->i_mutex); 870 mutex_unlock(&d_inode(dentry)->i_mutex);
871 if (ret) 871 if (ret)
872 d_delete(dentry); 872 d_delete(dentry);
873 } 873 }
@@ -1075,7 +1075,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
1075 * subsystem is really registered, and so we need to lock out 1075 * subsystem is really registered, and so we need to lock out
1076 * configfs_[un]register_subsystem(). 1076 * configfs_[un]register_subsystem().
1077 */ 1077 */
1078 mutex_lock(&root->d_inode->i_mutex); 1078 mutex_lock(&d_inode(root)->i_mutex);
1079 1079
1080 root_sd = root->d_fsdata; 1080 root_sd = root->d_fsdata;
1081 1081
@@ -1111,7 +1111,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
1111out_unlock_dirent_lock: 1111out_unlock_dirent_lock:
1112 spin_unlock(&configfs_dirent_lock); 1112 spin_unlock(&configfs_dirent_lock);
1113out_unlock_fs: 1113out_unlock_fs:
1114 mutex_unlock(&root->d_inode->i_mutex); 1114 mutex_unlock(&d_inode(root)->i_mutex);
1115 1115
1116 /* 1116 /*
1117 * If we succeeded, the fs is pinned via other methods. If not, 1117 * If we succeeded, the fs is pinned via other methods. If not,
@@ -1453,11 +1453,11 @@ int configfs_rename_dir(struct config_item * item, const char *new_name)
1453 down_write(&configfs_rename_sem); 1453 down_write(&configfs_rename_sem);
1454 parent = item->parent->dentry; 1454 parent = item->parent->dentry;
1455 1455
1456 mutex_lock(&parent->d_inode->i_mutex); 1456 mutex_lock(&d_inode(parent)->i_mutex);
1457 1457
1458 new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); 1458 new_dentry = lookup_one_len(new_name, parent, strlen(new_name));
1459 if (!IS_ERR(new_dentry)) { 1459 if (!IS_ERR(new_dentry)) {
1460 if (!new_dentry->d_inode) { 1460 if (d_really_is_negative(new_dentry)) {
1461 error = config_item_set_name(item, "%s", new_name); 1461 error = config_item_set_name(item, "%s", new_name);
1462 if (!error) { 1462 if (!error) {
1463 d_add(new_dentry, NULL); 1463 d_add(new_dentry, NULL);
@@ -1469,7 +1469,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name)
1469 error = -EEXIST; 1469 error = -EEXIST;
1470 dput(new_dentry); 1470 dput(new_dentry);
1471 } 1471 }
1472 mutex_unlock(&parent->d_inode->i_mutex); 1472 mutex_unlock(&d_inode(parent)->i_mutex);
1473 up_write(&configfs_rename_sem); 1473 up_write(&configfs_rename_sem);
1474 1474
1475 return error; 1475 return error;
@@ -1482,7 +1482,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
1482 struct configfs_dirent * parent_sd = dentry->d_fsdata; 1482 struct configfs_dirent * parent_sd = dentry->d_fsdata;
1483 int err; 1483 int err;
1484 1484
1485 mutex_lock(&dentry->d_inode->i_mutex); 1485 mutex_lock(&d_inode(dentry)->i_mutex);
1486 /* 1486 /*
1487 * Fake invisibility if dir belongs to a group/default groups hierarchy 1487 * Fake invisibility if dir belongs to a group/default groups hierarchy
1488 * being attached 1488 * being attached
@@ -1495,7 +1495,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
1495 else 1495 else
1496 err = 0; 1496 err = 0;
1497 } 1497 }
1498 mutex_unlock(&dentry->d_inode->i_mutex); 1498 mutex_unlock(&d_inode(dentry)->i_mutex);
1499 1499
1500 return err; 1500 return err;
1501} 1501}
@@ -1505,11 +1505,11 @@ static int configfs_dir_close(struct inode *inode, struct file *file)
1505 struct dentry * dentry = file->f_path.dentry; 1505 struct dentry * dentry = file->f_path.dentry;
1506 struct configfs_dirent * cursor = file->private_data; 1506 struct configfs_dirent * cursor = file->private_data;
1507 1507
1508 mutex_lock(&dentry->d_inode->i_mutex); 1508 mutex_lock(&d_inode(dentry)->i_mutex);
1509 spin_lock(&configfs_dirent_lock); 1509 spin_lock(&configfs_dirent_lock);
1510 list_del_init(&cursor->s_sibling); 1510 list_del_init(&cursor->s_sibling);
1511 spin_unlock(&configfs_dirent_lock); 1511 spin_unlock(&configfs_dirent_lock);
1512 mutex_unlock(&dentry->d_inode->i_mutex); 1512 mutex_unlock(&d_inode(dentry)->i_mutex);
1513 1513
1514 release_configfs_dirent(cursor); 1514 release_configfs_dirent(cursor);
1515 1515
@@ -1567,7 +1567,7 @@ static int configfs_readdir(struct file *file, struct dir_context *ctx)
1567 spin_lock(&configfs_dirent_lock); 1567 spin_lock(&configfs_dirent_lock);
1568 dentry = next->s_dentry; 1568 dentry = next->s_dentry;
1569 if (dentry) 1569 if (dentry)
1570 inode = dentry->d_inode; 1570 inode = d_inode(dentry);
1571 if (inode) 1571 if (inode)
1572 ino = inode->i_ino; 1572 ino = inode->i_ino;
1573 spin_unlock(&configfs_dirent_lock); 1573 spin_unlock(&configfs_dirent_lock);
@@ -1590,7 +1590,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
1590{ 1590{
1591 struct dentry * dentry = file->f_path.dentry; 1591 struct dentry * dentry = file->f_path.dentry;
1592 1592
1593 mutex_lock(&dentry->d_inode->i_mutex); 1593 mutex_lock(&d_inode(dentry)->i_mutex);
1594 switch (whence) { 1594 switch (whence) {
1595 case 1: 1595 case 1:
1596 offset += file->f_pos; 1596 offset += file->f_pos;
@@ -1598,7 +1598,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
1598 if (offset >= 0) 1598 if (offset >= 0)
1599 break; 1599 break;
1600 default: 1600 default:
1601 mutex_unlock(&dentry->d_inode->i_mutex); 1601 mutex_unlock(&d_inode(dentry)->i_mutex);
1602 return -EINVAL; 1602 return -EINVAL;
1603 } 1603 }
1604 if (offset != file->f_pos) { 1604 if (offset != file->f_pos) {
@@ -1624,7 +1624,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
1624 spin_unlock(&configfs_dirent_lock); 1624 spin_unlock(&configfs_dirent_lock);
1625 } 1625 }
1626 } 1626 }
1627 mutex_unlock(&dentry->d_inode->i_mutex); 1627 mutex_unlock(&d_inode(dentry)->i_mutex);
1628 return offset; 1628 return offset;
1629} 1629}
1630 1630
@@ -1654,7 +1654,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1654 sd = root->d_fsdata; 1654 sd = root->d_fsdata;
1655 link_group(to_config_group(sd->s_element), group); 1655 link_group(to_config_group(sd->s_element), group);
1656 1656
1657 mutex_lock_nested(&root->d_inode->i_mutex, I_MUTEX_PARENT); 1657 mutex_lock_nested(&d_inode(root)->i_mutex, I_MUTEX_PARENT);
1658 1658
1659 err = -ENOMEM; 1659 err = -ENOMEM;
1660 dentry = d_alloc_name(root, group->cg_item.ci_name); 1660 dentry = d_alloc_name(root, group->cg_item.ci_name);
@@ -1664,7 +1664,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1664 err = configfs_attach_group(sd->s_element, &group->cg_item, 1664 err = configfs_attach_group(sd->s_element, &group->cg_item,
1665 dentry); 1665 dentry);
1666 if (err) { 1666 if (err) {
1667 BUG_ON(dentry->d_inode); 1667 BUG_ON(d_inode(dentry));
1668 d_drop(dentry); 1668 d_drop(dentry);
1669 dput(dentry); 1669 dput(dentry);
1670 } else { 1670 } else {
@@ -1674,7 +1674,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1674 } 1674 }
1675 } 1675 }
1676 1676
1677 mutex_unlock(&root->d_inode->i_mutex); 1677 mutex_unlock(&d_inode(root)->i_mutex);
1678 1678
1679 if (err) { 1679 if (err) {
1680 unlink_group(group); 1680 unlink_group(group);
@@ -1695,9 +1695,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
1695 return; 1695 return;
1696 } 1696 }
1697 1697
1698 mutex_lock_nested(&root->d_inode->i_mutex, 1698 mutex_lock_nested(&d_inode(root)->i_mutex,
1699 I_MUTEX_PARENT); 1699 I_MUTEX_PARENT);
1700 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 1700 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD);
1701 mutex_lock(&configfs_symlink_mutex); 1701 mutex_lock(&configfs_symlink_mutex);
1702 spin_lock(&configfs_dirent_lock); 1702 spin_lock(&configfs_dirent_lock);
1703 if (configfs_detach_prep(dentry, NULL)) { 1703 if (configfs_detach_prep(dentry, NULL)) {
@@ -1706,13 +1706,13 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
1706 spin_unlock(&configfs_dirent_lock); 1706 spin_unlock(&configfs_dirent_lock);
1707 mutex_unlock(&configfs_symlink_mutex); 1707 mutex_unlock(&configfs_symlink_mutex);
1708 configfs_detach_group(&group->cg_item); 1708 configfs_detach_group(&group->cg_item);
1709 dentry->d_inode->i_flags |= S_DEAD; 1709 d_inode(dentry)->i_flags |= S_DEAD;
1710 dont_mount(dentry); 1710 dont_mount(dentry);
1711 mutex_unlock(&dentry->d_inode->i_mutex); 1711 mutex_unlock(&d_inode(dentry)->i_mutex);
1712 1712
1713 d_delete(dentry); 1713 d_delete(dentry);
1714 1714
1715 mutex_unlock(&root->d_inode->i_mutex); 1715 mutex_unlock(&d_inode(root)->i_mutex);
1716 1716
1717 dput(dentry); 1717 dput(dentry);
1718 1718
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 56d2cdc9ae0a..403269ffcdf3 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -326,10 +326,10 @@ int configfs_create_file(struct config_item * item, const struct configfs_attrib
326 umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG; 326 umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG;
327 int error = 0; 327 int error = 0;
328 328
329 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_NORMAL); 329 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_NORMAL);
330 error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, 330 error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode,
331 CONFIGFS_ITEM_ATTR); 331 CONFIGFS_ITEM_ATTR);
332 mutex_unlock(&dir->d_inode->i_mutex); 332 mutex_unlock(&d_inode(dir)->i_mutex);
333 333
334 return error; 334 return error;
335} 335}
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index 5423a6a6ecc8..8d89f5fd0331 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -56,7 +56,7 @@ static const struct inode_operations configfs_inode_operations ={
56 56
57int configfs_setattr(struct dentry * dentry, struct iattr * iattr) 57int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
58{ 58{
59 struct inode * inode = dentry->d_inode; 59 struct inode * inode = d_inode(dentry);
60 struct configfs_dirent * sd = dentry->d_fsdata; 60 struct configfs_dirent * sd = dentry->d_fsdata;
61 struct iattr * sd_iattr; 61 struct iattr * sd_iattr;
62 unsigned int ia_valid = iattr->ia_valid; 62 unsigned int ia_valid = iattr->ia_valid;
@@ -186,7 +186,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in
186 if (!dentry) 186 if (!dentry)
187 return -ENOENT; 187 return -ENOENT;
188 188
189 if (dentry->d_inode) 189 if (d_really_is_positive(dentry))
190 return -EEXIST; 190 return -EEXIST;
191 191
192 sd = dentry->d_fsdata; 192 sd = dentry->d_fsdata;
@@ -194,7 +194,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in
194 if (!inode) 194 if (!inode)
195 return -ENOMEM; 195 return -ENOMEM;
196 196
197 p_inode = dentry->d_parent->d_inode; 197 p_inode = d_inode(dentry->d_parent);
198 p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; 198 p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME;
199 configfs_set_inode_lock_class(sd, inode); 199 configfs_set_inode_lock_class(sd, inode);
200 200
@@ -236,11 +236,11 @@ void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent)
236 236
237 if (dentry) { 237 if (dentry) {
238 spin_lock(&dentry->d_lock); 238 spin_lock(&dentry->d_lock);
239 if (!d_unhashed(dentry) && dentry->d_inode) { 239 if (!d_unhashed(dentry) && d_really_is_positive(dentry)) {
240 dget_dlock(dentry); 240 dget_dlock(dentry);
241 __d_drop(dentry); 241 __d_drop(dentry);
242 spin_unlock(&dentry->d_lock); 242 spin_unlock(&dentry->d_lock);
243 simple_unlink(parent->d_inode, dentry); 243 simple_unlink(d_inode(parent), dentry);
244 } else 244 } else
245 spin_unlock(&dentry->d_lock); 245 spin_unlock(&dentry->d_lock);
246 } 246 }
@@ -251,11 +251,11 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name)
251 struct configfs_dirent * sd; 251 struct configfs_dirent * sd;
252 struct configfs_dirent * parent_sd = dir->d_fsdata; 252 struct configfs_dirent * parent_sd = dir->d_fsdata;
253 253
254 if (dir->d_inode == NULL) 254 if (d_really_is_negative(dir))
255 /* no inode means this hasn't been made visible yet */ 255 /* no inode means this hasn't been made visible yet */
256 return; 256 return;
257 257
258 mutex_lock(&dir->d_inode->i_mutex); 258 mutex_lock(&d_inode(dir)->i_mutex);
259 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { 259 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
260 if (!sd->s_element) 260 if (!sd->s_element)
261 continue; 261 continue;
@@ -268,5 +268,5 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name)
268 break; 268 break;
269 } 269 }
270 } 270 }
271 mutex_unlock(&dir->d_inode->i_mutex); 271 mutex_unlock(&d_inode(dir)->i_mutex);
272} 272}