Skip to content

Commit bfbe5b3

Browse files
fs/ntfs3: fix deadlock in mark_as_free_ex
Reported-by: [email protected] Signed-off-by: Konstantin Komarov <[email protected]>
1 parent 013ff63 commit bfbe5b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/ntfs3/fsntfs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2454,10 +2454,12 @@ void mark_as_free_ex(struct ntfs_sb_info *sbi, CLST lcn, CLST len, bool trim)
24542454
{
24552455
CLST end, i, zone_len, zlen;
24562456
struct wnd_bitmap *wnd = &sbi->used.bitmap;
2457+
bool dirty = false;
24572458

24582459
down_write_nested(&wnd->rw_lock, BITMAP_MUTEX_CLUSTERS);
24592460
if (!wnd_is_used(wnd, lcn, len)) {
2460-
ntfs_set_state(sbi, NTFS_DIRTY_ERROR);
2461+
/* mark volume as dirty out of wnd->rw_lock */
2462+
dirty = true;
24612463

24622464
end = lcn + len;
24632465
len = 0;
@@ -2511,6 +2513,8 @@ void mark_as_free_ex(struct ntfs_sb_info *sbi, CLST lcn, CLST len, bool trim)
25112513

25122514
out:
25132515
up_write(&wnd->rw_lock);
2516+
if (dirty)
2517+
ntfs_set_state(sbi, NTFS_DIRTY_ERROR);
25142518
}
25152519

25162520
/*

0 commit comments

Comments
 (0)