Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5843793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:12:13+00:00 2026-05-22T12:12:13+00:00

Hello I have been trying to get Inotify to yield up a IN_UNMOUNT event

  • 0

Hello I have been trying to get Inotify to yield up a IN_UNMOUNT event but its not cooperating with me at all so I went and did a simple experiment with inotifywait and this is the result below:

paul@imaskar ~ $ inotifywait -r /storage/test/ -m
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/storage/test/ CREATE,ISDIR a
/storage/test/ OPEN,ISDIR a
/storage/test/ CLOSE_NOWRITE,CLOSE,ISDIR a
/storage/test/ DELETE,ISDIR a
/storage/test/a/ DELETE_SELF 
/storage/test/a/ IGNORED 
/storage/test/ IGNORED 

Basically what happens is It will pick up all of the other events such as create, open, etc…. but when I unmounted /storage/test/ it will emit a IGNORED for all watches that it had created, but it never emits a UNMOUNT event…

So it seems like I’m unable to get a IN_UNMOUNT event but all of the inotify documentation that I’ve read said that the kernel will add a IN_UNMOUNT bitflag to the event when a monitored file/directory backing storage was unmounted…

Here’s a simple C code from – Inotify patch

#include <stdio.h>
#include <stdlib.h>
#include <sys/inotify.h>

int main(int argc, char **argv)
{
        char buf[1024];
        struct inotify_event *ie;
        char *p;
        int i;
        ssize_t l;

        p = argv[1];
        i = inotify_init();
        inotify_add_watch(i, p, ~0);

        l = read(i, buf, sizeof(buf));
        printf("read %d bytes\n", l);
        ie = (struct inotify_event *) buf;
        printf("event mask: %x\n", ie->mask);
    return 0;
}

Anyway I did the following steps:

gcc -oinotify inotify.c
mkdir mnt
sudo mount -ttmpfs none mnt
mkdir mnt/d
./inotify mnt/d/

# Different shell
sudo umount mnt

And finally here is what it emits

read 16 bytes
event mask: 8000

So at this point in time I’m not sure if the problem is in the code or something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:12:14+00:00Added an answer on May 22, 2026 at 12:12 pm

    This appears to be a kernel bug which has been fixed as per LKML. Roughly since Kernel 2.6.31 the IN_UNMOUNT event has not been sent when inodes are umounted… This patch was for “34-longterm” aka Kernel 2.6.35(?).

    Anyway I was able to upgrade to Kernel 2.6.37 and re-ran the above tests and here’s the results:

    mkdir mnt
    sudo mount -ttmpfs none mnt
    mkdir mnt/d
    inotifywait -r mnt/d/ -m
    
    
    # Different shell
    sudo umount mnt
    

    And here’s the output:

    Setting up watches.  Beware: since -r was given, this may take a while!
    Watches established.
    /tmp/test/d/ UNMOUNT 
    /tmp/test/d/ IGNORED 
    /tmp/test/ UNMOUNT 
    /tmp/test/ IGNORED 
    

    And as per the sample C code here’s the output:

    read 32 bytes
    event mask: 2000
    

    And looking at the inotify.h headers, this is the correct event mask for the IN_UNMOUNT flag so that means its finally fixed ~2.6.35 or latter…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello guys, I have been trying to implement the DSUM function but failed to
Hello everyone I been trying get php uploader working but having a lot of
Hello I have been trying to format this date but it keeps giving me
I have been trying all day to get app-engine sdk to work nothing has
I have been trying to use JQuery UI but cant seem to get any
I have been trying to use regex but I cant seem to get it
hello ive been trying to get the current environment in rails but i think
Hello I have been trying to send an email in magento with out a
I have been trying to learn assembly for a few years now. I get
I have been trying to figure out why i cant get even the most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.