Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs/ntfs3: handle attr_set_size() errors when truncating files

If attr_set_size() fails while truncating down, the error is silently
ignored and the inode may be left in an inconsistent state.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

+4 -6
+4 -6
fs/ntfs3/file.c
··· 505 505 { 506 506 struct super_block *sb = inode->i_sb; 507 507 struct ntfs_inode *ni = ntfs_i(inode); 508 - int err, dirty = 0; 509 508 u64 new_valid; 509 + int err; 510 510 511 511 if (!S_ISREG(inode->i_mode)) 512 512 return 0; ··· 522 522 } 523 523 524 524 new_valid = ntfs_up_block(sb, min_t(u64, ni->i_valid, new_size)); 525 - 526 525 truncate_setsize(inode, new_size); 527 526 528 527 ni_lock(ni); ··· 535 536 ni->i_valid = new_valid; 536 537 537 538 ni_unlock(ni); 539 + if (unlikely(err)) 540 + return err; 538 541 539 542 ni->std_fa |= FILE_ATTRIBUTE_ARCHIVE; 540 543 inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); 541 544 if (!IS_DIRSYNC(inode)) { 542 - dirty = 1; 545 + mark_inode_dirty(inode); 543 546 } else { 544 547 err = ntfs_sync_inode(inode); 545 548 if (err) 546 549 return err; 547 550 } 548 - 549 - if (dirty) 550 - mark_inode_dirty(inode); 551 551 552 552 return 0; 553 553 }