Skip to content

Commit 57c720d

Browse files
pavelmachektorvalds
authored andcommitted
ocfs2: fix unbalanced locking
Based on what fails, function can return with nfs_sync_rwlock either locked or unlocked. That can not be right. Always return with lock unlocked on error. Fixes: 4cd9973 ("ocfs2: avoid inode removal while nfsd is accessing it") Signed-off-by: Pavel Machek (CIP) <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Gang He <[email protected]> Cc: Jun Piao <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 4510a5a commit 57c720d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/ocfs2/dlmglue.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2871,9 +2871,15 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex)
28712871

28722872
status = ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE,
28732873
0, 0);
2874-
if (status < 0)
2874+
if (status < 0) {
28752875
mlog(ML_ERROR, "lock on nfs sync lock failed %d\n", status);
28762876

2877+
if (ex)
2878+
up_write(&osb->nfs_sync_rwlock);
2879+
else
2880+
up_read(&osb->nfs_sync_rwlock);
2881+
}
2882+
28772883
return status;
28782884
}
28792885

0 commit comments

Comments
 (0)