linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sylvain Rochet <gradator@gradator.net>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-nfs@vger.kernel.org
Cc: Sylvain Rochet <gradator@gradator.net>
Subject: Re: PROBLEM: 2.6.35.7 to 3.0 Inotify events missing
Date: Sat, 20 Aug 2011 01:03:44 +0200	[thread overview]
Message-ID: <20110819230344.GA24784@gradator.net> (raw)
In-Reply-To: <20101018223540.GA20730@gradator.net>

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

Hi,

On Tue, Oct 19, 2010 at 12:35:40AM +0200, Sylvain Rochet wrote:
> 
> ... upgraded to 2.6.33.5, then 2.6.33.7, finally to 2.6.35.7, and I 
> always end up with the same ending, it seems inotify can miss some VFS 
> events from time to time.

I finally find out why.

The NFS server does not always know the name of the modified file, if 
the modified inode was cleared from the VFS cache fsnotify does not know 
as well the filename then inotify child events on directories are 
silently tossed.

Easy way to reproduce:

Add a few printk debug (here it only works if /data is the NFS export):

--- begin//fs/nfsd/vfs.c        2011-07-22 04:17:23.000000000 +0200
+++ linux-3.0/fs/nfsd/vfs.c     2011-07-30 03:18:17.837560809 +0200
@@ -975,6 +975,8 @@
        inode = dentry->d_inode;
        exp   = fhp->fh_export;
 
+       printk("nfsd write inode=%ld name=%s\n", inode->i_ino, dentry->d_name.name);
+
        /*
         * Request sync writes if
         *  -   the sync export option has been set, or

diff -Nru begin//include/linux/fsnotify.h linux-3.0/include/linux/fsnotify.h
--- begin//include/linux/fsnotify.h     2011-07-22 04:17:23.000000000 +0200
+++ linux-3.0/include/linux/fsnotify.h  2011-07-30 03:07:00.330239062 +0200
@@ -216,8 +232,15 @@
                mask |= FS_ISDIR;
 
        if (!(file->f_mode & FMODE_NONOTIFY)) {
+               if( !strcmp(path->mnt->mnt_mountpoint->d_name.name, "data") )
+                       printk("fsnotify modify inode=%ld name=%s\n", inode->i_ino, file->f_dentry->d_name.name);
                fsnotify_parent(path, NULL, mask);
                fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
+       } else {
+               if( !strcmp(path->mnt->mnt_mountpoint->d_name.name, "data") )
+                       printk("fsnotify modify-nonotify inode=%ld name=%s\n", inode->i_ino, file->f_dentry->d_name.name);
        }
 }


On the NFS client, open a fd and send some data:

# exec 1> test
# ls -la
# 

On the NFS server, check the kern log:

Aug 20 00:57:44 inotifydebug kernel: nfsd write inode=13 name=test
Aug 20 00:57:44 inotifydebug kernel: fsnotify modify inode=13 name=test

Everything goes well.

Now, clear the VFS cache on the NFS server:

# echo 3 > /proc/sys/vm/drop_caches 

On the NFS client, send some data to the fd:

# ls -la
# 

On the NFS server, check the kern log:

Aug 20 00:58:56 inotifydebug kernel: nfsd write inode=13 name=
Aug 20 00:58:56 inotifydebug kernel: fsnotify modify inode=13 name=

The filename is lost, fsnotify does not know the filename anymore, 
therefore inotify cannot send event about a modified file in a watched 
directory.

End of the story.

I guess this is almost impossible to fix this fsnotify bug, this is due 
by the fact that NFS use inode as file identifiers, so in some case this 
is impossible to know the modified filepath, and therefore impossible to 
match the file event to the directory watch.

Kind regards,
Sylvain

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

       reply	other threads:[~2011-08-19 23:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20101018223540.GA20730@gradator.net>
2011-08-19 23:03 ` Sylvain Rochet [this message]
     [not found]   ` <20110819230344.GA24784-XWGZPxRNpGHk1uMJSBkQmQ@public.gmane.org>
2011-08-19 23:37     ` PROBLEM: 2.6.35.7 to 3.0 Inotify events missing Jamie Lokier
     [not found]       ` <20110819233756.GI11512-DqlFc3psUjeg7Qil/0GVWOc42C6kRsbE@public.gmane.org>
2011-08-20  0:47         ` Sylvain Rochet
2011-08-20  3:21           ` Jamie Lokier
2011-08-20  1:29       ` Al Viro
2011-08-20  1:43         ` Randy Dunlap
2011-08-20  2:01           ` Al Viro
     [not found]         ` <20110820012943.GD2203-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-08-20  3:03           ` Jamie Lokier
     [not found]             ` <20110820030335.GA14899-DqlFc3psUjeg7Qil/0GVWOc42C6kRsbE@public.gmane.org>
2011-08-21 17:07               ` J. Bruce Fields
     [not found]                 ` <20110821170714.GB9296-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2011-08-21 20:20                   ` Jamie Lokier
2011-08-21 23:07                     ` NeilBrown
2011-08-22 17:22                       ` J. Bruce Fields
     [not found]                         ` <20110822172239.GA15960-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2011-08-22 23:21                           ` NeilBrown
2011-08-25 21:47       ` Sylvain Rochet
2011-08-21 22:29   ` NeilBrown

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=20110819230344.GA24784@gradator.net \
    --to=gradator@gradator.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).