mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Love <rml@novell.com>
To: John McCutchan <ttb@tentacle.dhs.org>
Cc: linux-kernel@vger.kernel.org, viro@parcelfarce.linux.theplanet.co.uk
Subject: Re: [RFC][PATCH] inotify 0.9.2
Date: Tue, 21 Sep 2004 14:56:36 -0400	[thread overview]
Message-ID: <1095792996.4944.59.camel@betsy.boston.ximian.com> (raw)
In-Reply-To: <1095782674.4944.41.camel@betsy.boston.ximian.com>

[-- Attachment #1: Type: text/plain, Size: 903 bytes --]

On Tue, 2004-09-21 at 12:04 -0400, Robert Love wrote:

> Hey, John.
> 
> We are seeing an oops when monitoring a large number of directories.
> The system keeps running, but I/O gets flaky and eventually processes
> start getting stuck.
> 
> Also, the ioctl() stops returning new WD after 1024.  Thereafter, it
> keeps returning the same value.
> 
> I have attached the relevant bits from the syslog.  I will debug it, but
> I thought that perhaps you would immediately see the issue.

OK.  I fixed the problem with ioctl() failing after 1024 WD's.  This may
also fix the oopses.  Still checking on that.

The problem was that we were passing the size of dev->bitmask in _bytes_
to find_first_zero_bit().  But find_first_zero_bit()'s second parameter
is the size in _bits_.

I then went ahead and just made dev->bitmask an array, since we know the
size at compile time.

Comments?

Best,

	Robert Love


[-- Attachment #2: inotify-fix-wd-rml-1.patch --]
[-- Type: text/x-patch, Size: 1519 bytes --]

Fix problem with ioctl() failing after 1024 WD's, by giving ffz bits not bytes.
Signed-Off-By: Robert Love <rml@novell.com>

 drivers/char/inotify.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

--- linux-inotify-rml/drivers/char/inotify.c	2004-09-20 18:02:32.886258448 -0400
+++ linux/drivers/char/inotify.c	2004-09-21 14:51:11.433908024 -0400
@@ -43,7 +43,6 @@
 #define MAX_INOTIFY_DEVS 8 /* We only support X watchers */
 #define MAX_INOTIFY_DEV_WATCHERS 8192 /* A dev can only have Y watchers */
 #define MAX_INOTIFY_QUEUED_EVENTS 256 /* Only the first Z events will be queued */
-#define __BITMASK_SIZE (MAX_INOTIFY_DEV_WATCHERS / 8)
 
 #define INOTIFY_DEV_TIMER_TIME jiffies + (HZ/4)
 
@@ -71,7 +70,7 @@
 	struct timer_list	timer;
 	char			read_state;
 	spinlock_t		lock;
-	void *			bitmask;
+	unsigned long		bitmask[MAX_INOTIFY_DEV_WATCHERS / BITS_PER_LONG];
 };
 #define inotify_device_event_list(pos) list_entry((pos), struct inotify_event, list)
 
@@ -239,7 +238,7 @@
 
 	dev->watcher_count++;
 
-	wd = find_first_zero_bit (dev->bitmask, __BITMASK_SIZE);
+	wd = find_first_zero_bit (dev->bitmask, MAX_INOTIFY_DEV_WATCHERS);
 
 	set_bit (wd, dev->bitmask);
 
@@ -653,8 +652,7 @@
 	atomic_inc(&watcher_count);
 
 	dev = kmalloc(sizeof(struct inotify_device), GFP_KERNEL);
-	dev->bitmask = kmalloc(__BITMASK_SIZE, GFP_KERNEL);
-	memset(dev->bitmask, 0, __BITMASK_SIZE);
+	memset(dev->bitmask, 0, MAX_INOTIFY_DEV_WATCHERS);
 
 	INIT_LIST_HEAD(&dev->events);
 	INIT_LIST_HEAD(&dev->watchers);

  reply	other threads:[~2004-09-21 18:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-20  3:56 John McCutchan
2004-09-20 21:52 ` Robert Love
2004-09-21  5:21 ` Robert Love
2004-09-21 15:34   ` Edgar Toernig
2004-09-21 15:43     ` Chris Friesen
2004-09-22  2:27       ` John McCutchan
2004-09-23  1:46         ` Ray Lee
2004-09-23  3:42           ` John McCutchan
2004-09-23  4:52             ` Ray Lee
2004-09-23  5:10               ` Robert Love
2004-09-23  5:29                 ` Ray Lee
2004-09-21 15:46     ` Robert Love
2004-09-21  5:26 ` Robert Love
2004-09-21  5:44 ` Robert Love
2004-09-21 16:04 ` Robert Love
2004-09-21 18:56   ` Robert Love [this message]
2004-09-21 20:55     ` Robert Love
2004-09-22  2:32     ` John McCutchan
2004-09-22  3:49       ` Robert Love

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=1095792996.4944.59.camel@betsy.boston.ximian.com \
    --to=rml@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ttb@tentacle.dhs.org \
    --cc=viro@parcelfarce.linux.theplanet.co.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®