Re: [PATCH] ovl: skip ovl_file_modified() for dedupe operations
Amir Goldstein <[email protected]>
| Newsgroups | org.kernel.vger.linux-unionfs |
|---|---|
| Message-ID | <CAOQ4uxh+wF6T9np25kqoxMPsiz4DCTofJ-4Xt4=1FNaspzh_rw@mail.gmail.com> |
On Fri, Apr 17, 2026 at 10:39 AM cuitao <[email protected]> wrote: > > DEDUPE only compares data blocks between two files without modifying > file_out, Not accurate. It does not modify the data value. It definitely does modify the file's metadata as well as its ctime. > so there is no need to call ovl_file_modified() to sync > attributes from the real inode. This aligns with the existing > guard at the top of ovl_copyfile() which already skips copyattr > and file_remove_privs for OVL_DEDUPE. > > Signed-off-by: cuitao <[email protected]> > --- > fs/overlayfs/file.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c > index 27cc07738f33..f1829f425f45 100644 > --- a/fs/overlayfs/file.c > +++ b/fs/overlayfs/file.c > @@ -572,7 +572,8 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in, > } > > /* Update size */ > - ovl_file_modified(file_out); > + if (op != OVL_DEDUPE) > + ovl_file_modified(file_out); > This is wrong because ovl_file_modified() also copied ctime. You could update the comment above to say /* Update size/mtime/ctime */ but this is not very important IMO. Thanks, Amir.