Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 5024878

Browse files
ChenXiaoSongSteve French
ChenXiaoSong
authored and
Steve French
committed
cifs: fix missing unlock in cifs_file_copychunk_range()
xfstests generic/013 and generic/476 reported WARNING as follows: WARNING: lock held when returning to user space! 6.1.0-rc5+ #4 Not tainted ------------------------------------------------ fsstress/504233 is leaving the kernel with locks still held! 2 locks held by fsstress/504233: #0: ffff888054c38850 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: lock_two_nondirectories+0xcf/0xf0 #1: ffff8880b8fec750 (&sb->s_type->i_mutex_key#21/4){+.+.}-{3:3}, at: lock_two_nondirectories+0xb7/0xf0 This will lead to deadlock and hungtask. Fix this by releasing locks when failed to write out on a file range in cifs_file_copychunk_range(). Fixes: 3e3761f ("smb3: use filemap_write_and_wait_range instead of filemap_write_and_wait") Cc: [email protected] # 6.0 Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: ChenXiaoSong <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent f391d6e commit 5024878

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/cifs/cifsfs.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
12811281
rc = filemap_write_and_wait_range(src_inode->i_mapping, off,
12821282
off + len - 1);
12831283
if (rc)
1284-
goto out;
1284+
goto unlock;
12851285

12861286
/* should we flush first and last page first */
12871287
truncate_inode_pages(&target_inode->i_data, 0);
@@ -1297,6 +1297,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
12971297
* that target is updated on the server
12981298
*/
12991299
CIFS_I(target_inode)->time = 0;
1300+
1301+
unlock:
13001302
/* although unlocking in the reverse order from locking is not
13011303
* strictly necessary here it is a little cleaner to be consistent
13021304
*/

0 commit comments

Comments
 (0)