Re: [PATCH v5] ntfs: roll back the ACL xattr commit when the WSL mode update fails
From: Hyunchul Lee
Date: Wed Oct 14 2026 - 20:22:20 EST
On Tue, Oct 13, 2026 at 09:56:52AM +0800, Hongling Zeng wrote:
> ntfs_set_acl_ex() commits the ACL xattr before it rewrites the WSL
> mode EA, and removes it again when the rewrite fails. That only
> undoes a set that created the xattr: when the update replaced or
> removed an existing one, the old ACL is discarded along with the
> failed update. No error is recorded when the undo fails, so the
> new, typically more permissive, ACL is left on disk while i_mode,
> the mode EA and the cached ACL keep the old values. After a
> remount, a chmod 0640 -> 0777 that reported failure leaves the file
> accessible to the relaxed ACL while stat() still reports 0640.
>
> Save the previous xattr before committing the update, and restore it
> when the mode EA rewrite fails. A removed xattr is created again,
> since XATTR_REPLACE fails with -ENODATA once the removal dropped the
> entry. Remove the new xattr only when there was no previous one, and
> skip the undo when the commit changed nothing. A failed rollback is
> recorded: NVolSetErrors(), which the next persistence point persists
> as VOLUME_IS_DIRTY, and a log message the errors= policy acts on.
> The flag cannot be written to disk here directly: the target inode's
> mrec_lock is held and the $Volume mrec_lock cannot be nested under
> it.
>
> Fixes: fc053f05ca28 ("ntfs: add reparse and ea operations")
> Cc: stable@xxxxxxxxxxxxxxx
> Suggested-by: Hyunchul Lee <hyc.lee@xxxxxxxxx>
> Signed-off-by: Hongling Zeng <zenghongling@xxxxxxxxxx>
Looks good to me.
Reviewed-by: Hyunchul Lee <hyc.lee@xxxxxxxxx>
--
Thanks,
Hyunchul