From: Ingo Oeser <ioe-lkml@rameria.de>
To: linux-kernel@vger.kernel.org
Cc: Robert Love <rml@novell.com>, John McCutchan <ttb@tentacle.dhs.org>
Subject: Re: [PATCH] inotify: fix one-shot support
Date: Thu, 9 Feb 2006 09:42:43 +0100 [thread overview]
Message-ID: <200602090942.44977.ioe-lkml@rameria.de> (raw)
In-Reply-To: <1139415393.8883.193.camel@betsy.boston.ximian.com>
Hi Robert,
hi John,
On Wednesday 08 February 2006 17:16, Robert Love wrote:
> On Wed, 2006-02-08 at 08:52 +0100, Ingo Oeser wrote:
> > See, now you can just pass IN_ONESHOT behavior flag without any
> > events to shoot at, which you couldn't do before. But this makes only
> > sense, if we would like to set a multi-shot mask to one-shot now.
>
> Ack!
Ok, here comes the patch (against Linus' HEAD).
It turned out, that we needed to change some more places to avoid having zero
events to watch for. If you are ok with it, I'll send it straight to Linus with
your Ack included and in proper patch format.
Regards
Ingo Oeser
diff --git a/fs/inotify.c b/fs/inotify.c
index 3041503..16ec5fb 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -935,6 +935,7 @@ asmlinkage long sys_inotify_add_watch(in
struct file *filp;
int ret, fput_needed;
int mask_add = 0;
+ int no_events = 0;
unsigned flags = 0;
filp = fget_light(fd, &fput_needed);
@@ -966,9 +967,13 @@ asmlinkage long sys_inotify_add_watch(in
if (mask & IN_MASK_ADD)
mask_add = 1;
- /* don't let user-space set invalid bits: we don't want flags set */
+ /* Do we change and events or only multishot/singleshot? */
+ if (!(mask & IN_ALL_EVENTS))
+ no_events = 1;
+
+ /* Don't let user-space set invalid bits: we don't want flags set. */
mask &= IN_ALL_EVENTS | IN_ONESHOT;
- if (unlikely(!mask)) {
+ if (unlikely(no_events && !mask_add)) {
ret = -EINVAL;
goto out;
}
@@ -987,6 +992,15 @@ asmlinkage long sys_inotify_add_watch(in
goto out;
}
+ /*
+ * Want to change only multishot/singleshot,
+ * but has no existing watch? -> Illegal -ioe
+ */
+ if (unlikely(no_events)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
watch = create_watch(dev, mask, inode);
if (unlikely(IS_ERR(watch))) {
ret = PTR_ERR(watch);
prev parent reply other threads:[~2006-02-09 8:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200602080105.k1815her002647@hera.kernel.org>
2006-02-08 7:52 ` Ingo Oeser
2006-02-08 16:16 ` Robert Love
2006-02-09 8:42 ` Ingo Oeser [this message]
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=200602090942.44977.ioe-lkml@rameria.de \
--to=ioe-lkml@rameria.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@novell.com \
--cc=ttb@tentacle.dhs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®