diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-22 15:40:57 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-22 18:04:28 -0500 |
commit | 5955102c9984fa081b2d570cfac75c97eecf8f3b (patch) | |
tree | a4744386eac4b916e847eb4eedfada158f6527b4 /fs/tracefs | |
parent | 57b8f112cfe6622ddddb8c2641206bb5fa8a112d (diff) |
wrappers for ->i_mutex access
parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
inode_foo(inode) being mutex_foo(&inode->i_mutex).
Please, use those for access to ->i_mutex; over the coming cycle
->i_mutex will become rwsem, with ->lookup() done with it held
only shared.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/tracefs')
-rw-r--r-- | fs/tracefs/inode.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index c66f2423e1f5..4a0e48f92104 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c | |||
@@ -84,9 +84,9 @@ static int tracefs_syscall_mkdir(struct inode *inode, struct dentry *dentry, umo | |||
84 | * the files within the tracefs system. It is up to the individual | 84 | * the files within the tracefs system. It is up to the individual |
85 | * mkdir routine to handle races. | 85 | * mkdir routine to handle races. |
86 | */ | 86 | */ |
87 | mutex_unlock(&inode->i_mutex); | 87 | inode_unlock(inode); |
88 | ret = tracefs_ops.mkdir(name); | 88 | ret = tracefs_ops.mkdir(name); |
89 | mutex_lock(&inode->i_mutex); | 89 | inode_lock(inode); |
90 | 90 | ||
91 | kfree(name); | 91 | kfree(name); |
92 | 92 | ||
@@ -109,13 +109,13 @@ static int tracefs_syscall_rmdir(struct inode *inode, struct dentry *dentry) | |||
109 | * This time we need to unlock not only the parent (inode) but | 109 | * This time we need to unlock not only the parent (inode) but |
110 | * also the directory that is being deleted. | 110 | * also the directory that is being deleted. |
111 | */ | 111 | */ |
112 | mutex_unlock(&inode->i_mutex); | 112 | inode_unlock(inode); |
113 | mutex_unlock(&dentry->d_inode->i_mutex); | 113 | inode_unlock(dentry->d_inode); |
114 | 114 | ||
115 | ret = tracefs_ops.rmdir(name); | 115 | ret = tracefs_ops.rmdir(name); |
116 | 116 | ||
117 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT); | 117 | inode_lock_nested(inode, I_MUTEX_PARENT); |
118 | mutex_lock(&dentry->d_inode->i_mutex); | 118 | inode_lock(dentry->d_inode); |
119 | 119 | ||
120 | kfree(name); | 120 | kfree(name); |
121 | 121 | ||
@@ -334,7 +334,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
334 | if (!parent) | 334 | if (!parent) |
335 | parent = tracefs_mount->mnt_root; | 335 | parent = tracefs_mount->mnt_root; |
336 | 336 | ||
337 | mutex_lock(&parent->d_inode->i_mutex); | 337 | inode_lock(parent->d_inode); |
338 | dentry = lookup_one_len(name, parent, strlen(name)); | 338 | dentry = lookup_one_len(name, parent, strlen(name)); |
339 | if (!IS_ERR(dentry) && dentry->d_inode) { | 339 | if (!IS_ERR(dentry) && dentry->d_inode) { |
340 | dput(dentry); | 340 | dput(dentry); |
@@ -342,7 +342,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
342 | } | 342 | } |
343 | 343 | ||
344 | if (IS_ERR(dentry)) { | 344 | if (IS_ERR(dentry)) { |
345 | mutex_unlock(&parent->d_inode->i_mutex); | 345 | inode_unlock(parent->d_inode); |
346 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); | 346 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); |
347 | } | 347 | } |
348 | 348 | ||
@@ -351,7 +351,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
351 | 351 | ||
352 | static struct dentry *failed_creating(struct dentry *dentry) | 352 | static struct dentry *failed_creating(struct dentry *dentry) |
353 | { | 353 | { |
354 | mutex_unlock(&dentry->d_parent->d_inode->i_mutex); | 354 | inode_unlock(dentry->d_parent->d_inode); |
355 | dput(dentry); | 355 | dput(dentry); |
356 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); | 356 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); |
357 | return NULL; | 357 | return NULL; |
@@ -359,7 +359,7 @@ static struct dentry *failed_creating(struct dentry *dentry) | |||
359 | 359 | ||
360 | static struct dentry *end_creating(struct dentry *dentry) | 360 | static struct dentry *end_creating(struct dentry *dentry) |
361 | { | 361 | { |
362 | mutex_unlock(&dentry->d_parent->d_inode->i_mutex); | 362 | inode_unlock(dentry->d_parent->d_inode); |
363 | return dentry; | 363 | return dentry; |
364 | } | 364 | } |
365 | 365 | ||
@@ -544,9 +544,9 @@ void tracefs_remove(struct dentry *dentry) | |||
544 | if (!parent || !parent->d_inode) | 544 | if (!parent || !parent->d_inode) |
545 | return; | 545 | return; |
546 | 546 | ||
547 | mutex_lock(&parent->d_inode->i_mutex); | 547 | inode_lock(parent->d_inode); |
548 | ret = __tracefs_remove(dentry, parent); | 548 | ret = __tracefs_remove(dentry, parent); |
549 | mutex_unlock(&parent->d_inode->i_mutex); | 549 | inode_unlock(parent->d_inode); |
550 | if (!ret) | 550 | if (!ret) |
551 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); | 551 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); |
552 | } | 552 | } |
@@ -572,7 +572,7 @@ void tracefs_remove_recursive(struct dentry *dentry) | |||
572 | 572 | ||
573 | parent = dentry; | 573 | parent = dentry; |
574 | down: | 574 | down: |
575 | mutex_lock(&parent->d_inode->i_mutex); | 575 | inode_lock(parent->d_inode); |
576 | loop: | 576 | loop: |
577 | /* | 577 | /* |
578 | * The parent->d_subdirs is protected by the d_lock. Outside that | 578 | * The parent->d_subdirs is protected by the d_lock. Outside that |
@@ -587,7 +587,7 @@ void tracefs_remove_recursive(struct dentry *dentry) | |||
587 | /* perhaps simple_empty(child) makes more sense */ | 587 | /* perhaps simple_empty(child) makes more sense */ |
588 | if (!list_empty(&child->d_subdirs)) { | 588 | if (!list_empty(&child->d_subdirs)) { |
589 | spin_unlock(&parent->d_lock); | 589 | spin_unlock(&parent->d_lock); |
590 | mutex_unlock(&parent->d_inode->i_mutex); | 590 | inode_unlock(parent->d_inode); |
591 | parent = child; | 591 | parent = child; |
592 | goto down; | 592 | goto down; |
593 | } | 593 | } |
@@ -608,10 +608,10 @@ void tracefs_remove_recursive(struct dentry *dentry) | |||
608 | } | 608 | } |
609 | spin_unlock(&parent->d_lock); | 609 | spin_unlock(&parent->d_lock); |
610 | 610 | ||
611 | mutex_unlock(&parent->d_inode->i_mutex); | 611 | inode_unlock(parent->d_inode); |
612 | child = parent; | 612 | child = parent; |
613 | parent = parent->d_parent; | 613 | parent = parent->d_parent; |
614 | mutex_lock(&parent->d_inode->i_mutex); | 614 | inode_lock(parent->d_inode); |
615 | 615 | ||
616 | if (child != dentry) | 616 | if (child != dentry) |
617 | /* go up */ | 617 | /* go up */ |
@@ -619,7 +619,7 @@ void tracefs_remove_recursive(struct dentry *dentry) | |||
619 | 619 | ||
620 | if (!__tracefs_remove(child, parent)) | 620 | if (!__tracefs_remove(child, parent)) |
621 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); | 621 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); |
622 | mutex_unlock(&parent->d_inode->i_mutex); | 622 | inode_unlock(parent->d_inode); |
623 | } | 623 | } |
624 | 624 | ||
625 | /** | 625 | /** |