public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre PEIFFER <pierre.peiffer@stericsson.com>
To: <linux-kernel@vger.kernel.org>
Subject: inotify: notify IN_DELETE_SELF when file is deleted or inode deleted ?
Date: Fri, 29 Jun 2012 16:06:04 +0200	[thread overview]
Message-ID: <4FEDB64C.2040208@stericsson.com> (raw)

Hi,

By playing with inotify (on user side) to know whether the file I'm 
using is deleted by someone else,  I have noted that I do not receive 
the IN_DELETE_SELF event, exactly because I'm using it. By checking into 
kernel area, I see that at unlink(), an IN_ATTRIB event is sent, but 
IN_DELETE_SELF is, indeed, sent only when the inode is deleted.

But such IN_ATTRIB event doesn't tell to the user what has changed among 
permissions, timestamps, link count, etc...
So it doesn't much help. Of course, I have noted that I can monitor the 
parent directory for IN_DELETE and then check which file has been 
deleted; few more stuff to do but it works, no pb.

But I'm still wondering after reading in the man.:
            IN_DELETE_SELF    Watched file/directory was itself deleted.
Is this really the expected behavior ? Shouldn't the kernel trig such 
event at unlink() ? Or is inotify clearly inode oriented ?

Thanks,

Pierre

PS: keep me in cc, I'm not subscribed to the list.

             reply	other threads:[~2012-06-29 14:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29 14:06 Pierre PEIFFER [this message]
2012-07-06 18:16 ` inotify: notify IN_DELETE_SELF when file is deleted or inode deleted ? Eric Paris

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=4FEDB64C.2040208@stericsson.com \
    --to=pierre.peiffer@stericsson.com \
    --cc=linux-kernel@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