From: Eric Paris <eparis@redhat.com>
To: linux-kernel@vger.kernel.org, fs-devel@vger.kernel.org
Cc: torvalds@linux-foundation.org, viro@ZenIV.linux.org.uk
Subject: [PATCH 3/3] inotify: start watch descriptor count at 1
Date: Sun, 16 Aug 2009 21:51:55 -0400 [thread overview]
Message-ID: <20090817015155.15099.65278.stgit@paris.rdu.redhat.com> (raw)
In-Reply-To: <20090817015143.15099.80614.stgit@paris.rdu.redhat.com>
The inotify_add_watch man page specifies that inotify_add_watch() will
return a non-negative integer. However, historically the inotify watches
started at 1, not at 0. Turns out that the inotifywait program provided by
the inotify-tools package doesn't properly handle a 0 watch descriptor.
In 7e790dd5 we changed from starting at 1 to starting at 0. This patch
starts at 1, just like in previous kernels, but also just like in previous
kernels it's possible for it to wrap back to 0. This preserves the kernel
functionality exactly like it was before the patch (neither method broke
the spec)
Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/inotify/inotify_user.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 54cbded..ca0f36b 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -567,7 +567,7 @@ static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsign
spin_lock_init(&group->inotify_data.idr_lock);
idr_init(&group->inotify_data.idr);
- group->inotify_data.last_wd = 0;
+ group->inotify_data.last_wd = 1;
group->inotify_data.user = user;
group->inotify_data.fa = NULL;
prev parent reply other threads:[~2009-08-17 1:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-17 1:51 [PATCH 1/3] notify: unused event private race Eric Paris
2009-08-17 1:51 ` [PATCH 2/3] inotify: tail drop inotify q_overflow events Eric Paris
2009-08-17 1:51 ` Eric Paris [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=20090817015155.15099.65278.stgit@paris.rdu.redhat.com \
--to=eparis@redhat.com \
--cc=fs-devel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®