Re: [PATCH 05/18] VFS: dentry_create: always set FMODE_CREATE when file is created.
Jori Koolstra <jkoolstra-qWit8jRvyhVmR6Xm/[email protected]>
| Newsgroups | gmane.linux.nfs,gmane.linux.file-systems |
|---|---|
| Message-ID | <[email protected]> |
> Op 01-06-2026 08:37 CEST schreef NeilBrown <[email protected]>: > > > From: NeilBrown <neil-+NVA1uvv1dVBDLzU/[email protected]> > > atomic_open() may or may not need to create the file, and sets > FMODE_CREATE to indicate that it has. To allow the caller to know if > the file was actually created, set FMODE_CREATE in the vfs_create() > branch too. > > Signed-off-by: NeilBrown <neil-+NVA1uvv1dVBDLzU/[email protected]> > --- > fs/namei.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/namei.c b/fs/namei.c > index db3fddbccd21..e4f3c0d00c8c 100644 > --- a/fs/namei.c > +++ b/fs/namei.c > @@ -5137,6 +5137,8 @@ struct file *dentry_create(struct path *path, int flags, umode_t mode, > error = vfs_create(mnt_idmap(path->mnt), path->dentry, mode, NULL); > if (!error) > error = vfs_open(path, file); > + if (!error) > + file->f_mode |= FMODE_CREATED; What if vfs_create() succeeded but vfs_open() failed? Then we don't set FMODE_CREATED, why? > } > if (unlikely(error)) > return ERR_PTR(error); > -- > 2.50.0.107.gf914562f5916.dirty