mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Allow Ext2FSInode::write_bytes calls with a byte count of zero
write_bytes is called with a count of 0 bytes if a directory is being deleted, because in that case even the . and .. pseudo directories are getting removed. In this case write_bytes is now a no-op. Before write_bytes would fail because it would check to see if there were any blocks available to write in (even though it wasn't going to write in them anyway). This behaviour was uncovered because of a recent change where directories are correctly reduced in size. Which in this case results in all the blocks being removed from the inode, whereas previously there would be some stale blocks around to pass the check.
This commit is contained in:
parent
db06b106ae
commit
cab6155254
Notes:
sideshowbarker
2024-07-18 18:35:50 +09:00
Author: https://github.com/Maato Commit: https://github.com/SerenityOS/serenity/commit/cab61552543 Pull-request: https://github.com/SerenityOS/serenity/pull/6924 Issue: https://github.com/SerenityOS/serenity/issues/6919
1 changed files with 3 additions and 0 deletions
|
@ -971,6 +971,9 @@ KResultOr<ssize_t> Ext2FSInode::write_bytes(off_t offset, ssize_t count, const U
|
|||
VERIFY(offset >= 0);
|
||||
VERIFY(count >= 0);
|
||||
|
||||
if (count == 0)
|
||||
return 0;
|
||||
|
||||
Locker inode_locker(m_lock);
|
||||
|
||||
if (auto result = prepare_to_write_data(); result.is_error())
|
||||
|
|
Loading…
Reference in a new issue