From: Jamie Lokier <jamie@shareable.org>
To: "Joseph D. Wagner" <theman@josephdwagner.info>
Cc: matthew@wil.cx, willy@debian.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs/locks.c Partially fixes leases issue
Date: Thu, 4 Dec 2003 02:55:16 +0000 [thread overview]
Message-ID: <20031204025516.GB1216@mail.shareable.org> (raw)
In-Reply-To: <200312031748.37958.theman@josephdwagner.info>
Joseph D. Wagner wrote:
> Everything you need to know about the patch is documented in the patch
> itself.
Thanks. A couple of things about the patch:
> + if ((arg == F_RDLCK)
> + && ((atomic_read(&dentry->d_count) > 1)
> + || (atomic_read(&inode->i_count) > 1))) {
> [...]
> + goto out_unlock;
> if ((arg == F_WRLCK)
> && ((atomic_read(&dentry->d_count) > 1)
> || (atomic_read(&inode->i_count) > 1)))
> goto out_unlock;
These two are so similar they can be merged; just don't test "arg".
The long comment which I wrote as "[...]" above is excessive: the code
is clear without it. If every small patch had a comment that large,
the kernel would be all comments and it paradoxically makes it harder
to understand the code.
(I used to write lots of comments in code myself, until I discovered
colleages didn't read them because there were too many, so they
skipped the really important technical notes. Now I follow the
balance set by other programmers).
A short FIXME comment indicating that the F_RDLCK case is not
implemented properly is useful, though.
> I hope you find it useful, and I hope that my poor first
> impression will not prevent us from working together on filesystem
> development in the future.
No problem; welcome!
I don't agree with this patch as it is because, as Sean Neakums
pointed out, there is actually a field `inode->i_writecount' which is
remarkeably appropriate.
F_RDLCK should use `deny_write_access', and `get_write_access' should
be changed to break any F_RDLCK leases. (Checking that locking for
`break_lease' in the places where `get_write_access' is called is left
as an exercise).
F_WRLCK should use `get_write_accesss' because taking a write lease is
equivalent to demanding write access - it should break any outstanding
F_RDLCK leases. Alternatively, F_WRLCK should insist that
`filp->f_mode & FMODE_WRITE' is set.
-- Jamie
next prev parent reply other threads:[~2003-12-04 2:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-03 11:48 [PATCH] fs/locks.c Partially fixes leases issue Joseph D. Wagner
2003-12-04 2:55 ` Jamie Lokier [this message]
2003-12-03 15:49 ` Joseph D. Wagner
2003-12-04 5:15 ` Jamie Lokier
2003-12-04 13:31 ` Matthew Wilcox
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=20031204025516.GB1216@mail.shareable.org \
--to=jamie@shareable.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=theman@josephdwagner.info \
--cc=willy@debian.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.