From: David Howells <dhowells@redhat.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: dhowells@redhat.com, viro@ZenIV.linux.org.uk,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
hch@infradead.org, torvalds@linux-foundation.org,
mszeredi@suse.cz
Subject: Re: [PATCH 00/16] vfs: atomic open v4 (part 1)
Date: Thu, 24 May 2012 16:52:02 +0100 [thread overview]
Message-ID: <7204.1337874722@redhat.com> (raw)
In-Reply-To: <6422.1337872046@redhat.com>
I'd also recommend changing the "ok" and "common" labels in do_last() to
something a bit more meaningful, perhaps:
common -> finish_open
ok -> finish_open_may_want_write
Also, does it make sense to combine:
if (!S_ISREG(nd->inode->i_mode))
will_truncate = 0;
with:
int will_truncate = open_flag & O_TRUNC;
up at the top of the function.
As the code stands, if ->atomic_open() opens the file but does not create it,
handle_truncate() will be called on it even if it is not a regular file,
whereas by the normal path, it won't.
I would also be tempted to move the body of:
if (filp == ERR_PTR(-EOPENSTALE) && save_parent.dentry && !retried) {
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 (want_write) {
mnt_drop_write(nd->path.mnt);
want_write = 0;
}
retried = true;
goto retry_lookup;
}
before the retry_lookup label and then goto around it from the preceding
if-else statement or place it at the bottom to make the "common:" block simpler
to read. Also, you could nest the if (filp == ERR_PTR(-EOPENSTALE)...) inside
if (IS_ERR(filp)).
Can I also suggest being consistent about the use of int v bool? "created"
and "retried" are bool, but "will_truncate", "want_write" and "symlink_ok" are
not. Granted some of this is likely inherited from the previous incarnation.
David
next prev parent reply other threads:[~2012-05-24 15:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 12:44 [PATCH 00/16] vfs: atomic open v4 (part 1) Miklos Szeredi
2012-04-25 12:44 ` [PATCH 01/16] vfs: split do_lookup() Miklos Szeredi
2012-04-25 12:44 ` [PATCH 02/16] vfs: do_last(): make exit RCU safe Miklos Szeredi
2012-04-25 12:44 ` [PATCH 03/16] vfs: do_last(): inline walk_component() Miklos Szeredi
2012-04-25 12:44 ` [PATCH 04/16] vfs: do_last(): use inode variable Miklos Szeredi
2012-05-01 4:06 ` Nick Piggin
2012-05-07 14:28 ` Miklos Szeredi
2012-05-08 23:57 ` Nick Piggin
2012-04-25 12:44 ` [PATCH 05/16] vfs: make follow_link check RCU safe Miklos Szeredi
2012-04-25 12:44 ` [PATCH 06/16] vfs: do_last(): make ENOENT exit " Miklos Szeredi
2012-04-25 12:44 ` [PATCH 07/16] vfs: do_last(): check LOOKUP_DIRECTORY Miklos Szeredi
2012-04-25 12:44 ` [PATCH 08/16] vfs: do_last(): only return EISDIR for O_CREAT Miklos Szeredi
2012-04-25 12:44 ` [PATCH 09/16] vfs: do_last(): add audit_inode before open Miklos Szeredi
2012-04-25 12:44 ` [PATCH 10/16] vfs: do_last() common post lookup Miklos Szeredi
2012-04-25 12:44 ` [PATCH 11/16] vfs: split __dentry_open() Miklos Szeredi
2012-04-25 12:44 ` [PATCH 12/16] vfs: do_dentry_open(): don't put filp Miklos Szeredi
2012-04-25 12:44 ` [PATCH 13/16] vfs: nameidata_to_filp(): inline __dentry_open() Miklos Szeredi
2012-04-25 12:44 ` [PATCH 14/16] vfs: nameidata_to_filp(): don't throw away file on error Miklos Szeredi
2012-04-25 12:44 ` [PATCH 15/16] vfs: retry last component if opening stale dentry Miklos Szeredi
2012-04-25 12:44 ` [PATCH 16/16] nfs: don't open in ->d_revalidate Miklos Szeredi
2012-05-24 15:07 ` [PATCH 00/16] vfs: atomic open v4 (part 1) David Howells
2012-05-25 14:58 ` Miklos Szeredi
2012-05-25 15:18 ` David Howells
2012-05-24 15:52 ` David Howells [this message]
2012-05-25 15:12 ` Miklos Szeredi
2012-05-25 15:20 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7204.1337874722@redhat.com \
--to=dhowells@redhat.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mszeredi@suse.cz \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).