Re: [PATCH RFC 06/24] vfs: break parent dir delegations in open(..., O_CREAT) codepath

From: Al Viro
Date: Sat Mar 16 2024 - 20:20:31 EST


On Fri, Mar 15, 2024 at 12:52:57PM -0400, Jeff Layton wrote:
> In order to add directory delegation support, we need to break
> delegations on the parent whenever there is going to be a change in the
> directory.
>
> Add a delegated_inode parameter to lookup_open and have it break the
> delegation. Then, open_last_lookups can wait for the delegation break
> and retry the call to lookup_open once it's done.

> @@ -3490,6 +3490,11 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file,

Wait a sec - are you going to do anything to the atomic_open side of things?

> /* Negative dentry, just create the file */
> if (!dentry->d_inode && (open_flag & O_CREAT)) {
> + /* but break the directory lease first! */
> + error = try_break_deleg(dir_inode, delegated_inode);
> + if (error)
> + goto out_dput;