Message ID | 20140717072241.2c1549a3@tlielax.poochiereds.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jul 17, 2014 at 1:22 PM, Jeff Layton <jeff.layton@primarydata.com> wrote: > What's so special about an EOPENSTALE return from finish_open that we > need to handle retries in do_last? It seems like we could get rid of the > stale_open label and just let do_filp_open handle it like we would > an ESTALE return from any other spot in the function. > > Just for giggles, here's an RFC patch. It builds but I haven't tested > it. It might also be possible to do some cleanup around saved_parent > with this. > > Thoughts? EOPENSTALE is an optimization for the redoing only the last component. It's the analogue of ->d_revalidate() failure, in which case lookup of that component only is retried path components before that are not. I'm not sure if it's a valid optimization, but if not, then we should also consider doing LOOKUP_REVAL on the whole path on any d_revalidate() failure as well. Thanks, Miklos -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 17 Jul 2014 14:52:00 +0200 Miklos Szeredi <miklos@szeredi.hu> wrote: > On Thu, Jul 17, 2014 at 1:22 PM, Jeff Layton > <jeff.layton@primarydata.com> wrote: > > > What's so special about an EOPENSTALE return from finish_open that we > > need to handle retries in do_last? It seems like we could get rid of the > > stale_open label and just let do_filp_open handle it like we would > > an ESTALE return from any other spot in the function. > > > > Just for giggles, here's an RFC patch. It builds but I haven't tested > > it. It might also be possible to do some cleanup around saved_parent > > with this. > > > > Thoughts? > > EOPENSTALE is an optimization for the redoing only the last component. > It's the analogue of ->d_revalidate() failure, in which case lookup of > that component only is retried path components before that are not. > > I'm not sure if it's a valid optimization, but if not, then we should > also consider doing LOOKUP_REVAL on the whole path on any > d_revalidate() failure as well. > > Thanks, > Miklos Ok, that makes sense and it's seems like good enough reason to keep it as is for now. We can just drop my RFC patch... Thanks,
diff --git a/fs/namei.c b/fs/namei.c index 985c6f368485..34c6d008d0e5 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2882,7 +2882,6 @@ static int do_last(struct nameidata *nd, struct path *path, struct inode *inode; bool symlink_ok = false; struct path save_parent = { .dentry = NULL, .mnt = NULL }; - bool retried = false; int error; nd->flags &= ~LOOKUP_PARENT; @@ -2927,7 +2926,6 @@ static int do_last(struct nameidata *nd, struct path *path, goto out; } -retry_lookup: if (op->open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) { error = mnt_want_write(nd->path.mnt); if (!error) @@ -3017,7 +3015,6 @@ finish_lookup: save_parent.dentry = nd->path.dentry; save_parent.mnt = mntget(path->mnt); nd->path.dentry = path->dentry; - } nd->inode = inode; /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */ @@ -3049,11 +3046,8 @@ finish_open_created: goto out; file->f_path.mnt = nd->path.mnt; error = finish_open(file, nd->path.dentry, NULL, opened); - if (error) { - if (error == -EOPENSTALE) - goto stale_open; + if (error) goto out; - } opened: error = open_check_o_direct(file); if (error) @@ -3080,24 +3074,6 @@ exit_dput: exit_fput: fput(file); goto out; - -stale_open: - /* If no saved parent or already retried then can't retry */ - if (!save_parent.dentry || retried) - goto out; - - BUG_ON(save_parent.dentry != dir); - path_put(&nd->path); - nd->path = save_parent; - nd->inode = dir->d_inode; - save_parent.mnt = NULL; - save_parent.dentry = NULL; - if (got_write) { - mnt_drop_write(nd->path.mnt); - got_write = false; - } - retried = true; - goto retry_lookup; } static int do_tmpfile(int dfd, struct filename *pathname,