Patch "ext4: forbid commit inconsistent quota data when errors=remount-ro" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ext4: forbid commit inconsistent quota data when errors=remount-ro

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ext4-forbid-commit-inconsistent-quota-data-when-erro.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6b62378519202052dd5f4b173e492c39bc02daab
Author: Ye Bin <yebin10@xxxxxxxxxx>
Date:   Fri Jan 19 14:29:08 2024 +0800

    ext4: forbid commit inconsistent quota data when errors=remount-ro
    
    [ Upstream commit d8b945fa475f13d787df00c26a6dc45a3e2e1d1d ]
    
    There's issue as follows When do IO fault injection test:
    Quota error (device dm-3): find_block_dqentry: Quota for id 101 referenced but not present
    Quota error (device dm-3): qtree_read_dquot: Can't read quota structure for id 101
    Quota error (device dm-3): do_check_range: Getting block 2021161007 out of range 1-186
    Quota error (device dm-3): qtree_read_dquot: Can't read quota structure for id 661
    
    Now, ext4_write_dquot()/ext4_acquire_dquot()/ext4_release_dquot() may commit
    inconsistent quota data even if process failed. This may lead to filesystem
    corruption.
    To ensure filesystem consistent when errors=remount-ro there is need to call
    ext4_handle_error() to abort journal.
    
    Signed-off-by: Ye Bin <yebin10@xxxxxxxxxx>
    Reviewed-by: Jan Kara <jack@xxxxxxx>
    Link: https://lore.kernel.org/r/20240119062908.3598806-1-yebin10@xxxxxxxxxx
    Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e386d67cff9d1..0149d3c2cfd78 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -6205,6 +6205,10 @@ static int ext4_write_dquot(struct dquot *dquot)
 	if (IS_ERR(handle))
 		return PTR_ERR(handle);
 	ret = dquot_commit(dquot);
+	if (ret < 0)
+		ext4_error_err(dquot->dq_sb, -ret,
+			       "Failed to commit dquot type %d",
+			       dquot->dq_id.type);
 	err = ext4_journal_stop(handle);
 	if (!ret)
 		ret = err;
@@ -6221,6 +6225,10 @@ static int ext4_acquire_dquot(struct dquot *dquot)
 	if (IS_ERR(handle))
 		return PTR_ERR(handle);
 	ret = dquot_acquire(dquot);
+	if (ret < 0)
+		ext4_error_err(dquot->dq_sb, -ret,
+			      "Failed to acquire dquot type %d",
+			      dquot->dq_id.type);
 	err = ext4_journal_stop(handle);
 	if (!ret)
 		ret = err;
@@ -6240,6 +6248,10 @@ static int ext4_release_dquot(struct dquot *dquot)
 		return PTR_ERR(handle);
 	}
 	ret = dquot_release(dquot);
+	if (ret < 0)
+		ext4_error_err(dquot->dq_sb, -ret,
+			       "Failed to release dquot type %d",
+			       dquot->dq_id.type);
 	err = ext4_journal_stop(handle);
 	if (!ret)
 		ret = err;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux