On Fri, Sep 10, 2021 at 08:35:41AM +0300, Amir Goldstein wrote:
On Fri, Sep 10, 2021 at 3:17 AM Sasha Levin <sashal@xxxxxxxxxx> wrote:
From: Amir Goldstein <amir73il@xxxxxxxxx>
[ Upstream commit 72db82115d2bdfbfba8b15a92d91872cfe1b40c6 ]
When a lower file has sync/noatime fileattr flags, the behavior of
overlayfs post copy up is inconsistent.
Immediately after copy up, ovl inode still has the S_SYNC/S_NOATIME
inode flags copied from lower inode, so vfs code still treats the ovl
inode as sync/noatime. After ovl inode evict or mount cycle,
the ovl inode does not have these inode flags anymore.
To fix this inconsistency, try to copy the fileattr flags on copy up
if the upper fs supports the fileattr_set() method.
This gives consistent behavior post copy up regardless of inode eviction
from cache.
We cannot copy up the immutable/append-only inode flags in a similar
manner, because immutable/append-only inodes cannot be linked and because
overlayfs will not be able to set overlay.* xattr on the upper inodes.
Those flags will be addressed by a followup patch.
Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
Sasha,
I do not recommend applying this patch to stable.
The value/risk ratio is not worth it IMO.
I don't know of anyone who ever complained about not copying
the NOATIME/SYNC fileattrs specifically.
This patch is more of a complimentary patch to the IMMUTABLE/
APPEND fileattr patch, which is not appropriate for stable either.
Thanks! I'll drop it.
OTOH, ovl-update-5.15 has this patch that was not included in the
AUTOSEL batch, even though it has a Fixes tag, CC stable and
very strong hints in the subject:
52d5a0c6bd8a ("ovl: fix BUG_ON() in may_delete() when called from
ovl_cleanup()")
I suppose AUTOSEL leaves these sorts of patches to Greg's scripts?
That's correct. If it has a stable tag AUTOSEL won't look at it (why
should it? :) ).
--
Thanks,
Sasha