fs/ceph:fix double unlock in handle_cap_export()
PATCH v3 1/1 fs/ceph:fix double unlock in handle_cap_export()
If the ceph_mdsc_open_export_target_session() return fails, we should add mutex_lock(&session->s_mutex) on IS_ERR(tsession) block to avoid twice unlocking. because the session->s_mutex will be unlock at the out_unlock lable.
--
v2 -> v3:
- Rewrite solution, adding a mutex_lock(&session->s_mutex) to the IS_ERR(tsession) block.
- Modify the comment more clearly.
v1 -> v2:
- add spin_lock(&ci->i_ceph_lock) before goto out_unlock lable
--- fs/ceph/caps.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/caps.c +1 -0
@@ -3746,6 +3746,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,WARN_ON (1 ); tsession =NULL ; target =-1 ; +mutex_lock (&session->s_mutex); } goto retry;
Signature · 1 line
1.8.3.1
Quoted 33 lines · Wu Bo
If the
ceph_mdsc_open_export_target_session()return fails, we should addmutex_lock(&session->s_mutex)onIS_ERR(tsession)block to avoid twice unlocking. because thesession->s_mutexwill be unlock at theout_unlocklable.--
v2 -> v3:
- Rewrite solution, adding amutex_lock(&session->s_mutex)to theIS_ERR(tsession)block.
- Modify the comment more clearly.
v1 -> v2:
- addspin_lock(&ci->i_ceph_lock)before gotoout_unlocklableSigned-off-by Wu Bo <[email protected]>--- fs/ceph/caps.c | 1 + 1 file changed, 1 insertion(+)fs/ceph/caps.c +1
-1@@ -3746,6 +3746,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,WARN_ON (1 ); tsession =NULL ; target =-1 ; +mutex_lock (&session->s_mutex); } goto retry; --
Quoted 2 lines
1.8.3.1
Quoted 5 lines · Wu Bo
If the
ceph_mdsc_open_export_target_session()return fails, we should addmutex_lock(&session->s_mutex)onIS_ERR(tsession)block to avoid twice unlocking. because thesession->s_mutexwill be unlock at theout_unlocklable.
Quoted 8 lines
--
v2 -> v3:
- Rewrite solution, adding amutex_lock(&session->s_mutex)to theIS_ERR(tsession)block.
- Modify the comment more clearly.
v1 -> v2:
- addspin_lock(&ci->i_ceph_lock)before gotoout_unlocklable
For future reference, notes like this should go a little lower...
Quoted 7 lines
Signed-off-by Wu Bo <[email protected]>--- fs/ceph/caps.c | 1 + 1 file changed, 1 insertion(+)
If you put the patch version notes here, they'll be stripped out when we go to merge the patch with git-am.
fs/ceph/caps.c static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, · line 3752
Quoted 12 lines
fs/ceph/caps.c +1
-0@@ -3746,6 +3746,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,WARN_ON (1 ); tsession =NULL ; target =-1 ; +mutex_lock (&session->s_mutex); } goto retry;
Looks good. Merged, but I did clean up the verbiage in the changelog a bit.
Thanks!
Signature · 1 line
Jeff Layton <[email protected]>