From: Joel Becker <joel.becker@oracle.com>
To: ocfs2-devel@oss.oracle.com, linux-fsdevel@kernel.org,
viro@zeniv.linux.org.uk
Cc: hch@infradead.org
Subject: [PATCH 0/2] [RFC] Adding the MAY_CREATE flag to ->permission()
Date: Wed, 2 Sep 2009 18:06:52 -0700 [thread overview]
Message-ID: <1251940014-20963-1-git-send-email-joel.becker@oracle.com> (raw)
Hey,
Ran into a fun problem in ocfs2. ocfs2, being a cluster
filesystem, has cluster locks. Being nice to our users, we allow
signals to interrupt the cluster locking layer if it hasn't gotten too
far yet (sleeping on local locking rather than the cluster).
Now, system calls are only allowed to return -ERESTARTSYS if
they can be safely restarted. In ocfs2_mknod(), which underlies
mkdir(2), mknod(2), and creat(2), we allow signals to interrupt us while
we gather our locks, but once we start changing things, there's no going
back. Everyone else does the same thing.
The problem is open(O_CREAT|O_EXCL). See, ocfs2_mknod() will
successfully create the file. Then we get back to
__open_namei_create(), which promptly calls may_open(). This is
backended by ocfs2_permission(), and it needs the cluster lock to
check the new inode's permissions. Send a signal here, and the ocfs2
code will return -ERESTARTSYS. (This is easily verified via
'git-checkout'). When entry.S restarts the open(O_CREAT|O_EXCL), it
gets -EEXIST. Ouch!
We can't naively block signals in ocfs2_permission(). The
majority of calls are not for O_CREAT|O_EXCL. So how do we let
ocfs2_permission() know about this case?
Christoph's suggestion was a new flag to ->permission(). I've
picked MAY_CREATE, but I'm totally open to a better name. I'm open to a
better solution too.
Folling this are the MAY_CREATE patch and the ocfs2 patch to
make use of it.
Joel
next reply other threads:[~2009-09-03 1:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-03 1:06 Joel Becker [this message]
2009-09-03 1:06 ` [PATCH 1/2] vfs: Add MAY_CREATE to the permission() flags Joel Becker
2009-09-03 1:06 ` [PATCH 2/2] ocfs2: Use MAY_CREATE in ocfs2_permission() Joel Becker
2009-09-03 1:45 ` Sunil Mushran
2009-09-03 19:12 ` Joel Becker
-- strict thread matches above, loose matches on Subject: below --
2009-10-14 9:57 [PATCH 0/2] [RFC] Adding the MAY_CREATE flag to ->permission() Joel Becker
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=1251940014-20963-1-git-send-email-joel.becker@oracle.com \
--to=joel.becker@oracle.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@kernel.org \
--cc=ocfs2-devel@oss.oracle.com \
--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).