Skip to contentSkip to conversation

inotify and IN_UNMOUNT-events

DISCUSSION Juergen Quade 3 participants 4 messages Aug 30, 2005 – Aug 31, 2005

lore
Share & tools
lore
#0 lore raw

Playing around with inotify I have some problems to generate/receive IN_UNMOUNT-events (using a self written application and inotify_utils-0.25; kernel 2.6.13).

Doing:
- mount /dev/hda1 /mnt
- add a watch to the path /mnt/ ("./inotify_test /mnt")
- umount /mnt

results in two events:
1. IN_DELETE_SELF (mask=0x0400)
2. IN_IGNORED (mask=0x8000)

Any ideas?

Juergen.

#1 lore raw
Quoted 10 lines · Juergen Quade

Playing around with inotify I have some problems to generate/receive IN_UNMOUNT-events (using a self written application and inotify_utils-0.25; kernel 2.6.13).

Doing:
- mount /dev/hda1 /mnt
- add a watch to the path /mnt/ ("./inotify_test /mnt")
- umount /mnt

Quoted 5 lines

results in two events:
1. IN_DELETE_SELF (mask=0x0400)
2. IN_IGNORED (mask=0x8000)

Any ideas?

"/mnt" is not unmounted, stuff inside of it is.

Watch, say, "/mnt/foo/bar" and when /dev/hda1 is unmounted, you will get an IN_UNMOUNT on the watch.

Robert Love

#2 lore raw
Quoted 16 lines · Robert Love
Quoted 14 lines · Juergen Quade

Playing around with inotify I have some problems to generate/receive IN_UNMOUNT-events (using a self written application and inotify_utils-0.25; kernel 2.6.13).

Doing:
- mount /dev/hda1 /mnt
- add a watch to the path /mnt/ ("./inotify_test /mnt")
- umount /mnt

results in two events:
1. IN_DELETE_SELF (mask=0x0400)
2. IN_IGNORED (mask=0x8000)

Quoted 6 lines
Quoted 1 line

Any ideas?

"/mnt" is not unmounted, stuff inside of it is.

Watch, say, "/mnt/foo/bar" and when /dev/hda1 is unmounted, you will get an IN_UNMOUNT on the watch.

I think this might work as well:

# mount /dev/hda1 /mnt
# ./inotify_test /mnt/. &
# umount /mnt

That should get the effect you are looking for

Cheers,
Kyle Moffett

--
I have yet to see any problem, however complicated, which, when you looked at it in the right way, did not become still more complicated.
-- Poul Anderson

#3 lore raw
In reply to Robert Love
Quoted 11 lines
Quoted 6 lines

...
results in two events:
1. IN_DELETE_SELF (mask=0x0400)
2. IN_IGNORED (mask=0x8000)

Any ideas?

"/mnt" is not unmounted, stuff inside of it is.

Watch, say, "/mnt/foo/bar" and when /dev/hda1 is unmounted, you will get an IN_UNMOUNT on the watch.

I tried that too. Seems not to work (at least for me):

	root@mobil:/tmp/inotify-utils-0.25 # mount /dev/hda6 /mnt
	root@mobil:/tmp/inotify-utils-0.25 # ls /mnt/foo/bar
	/mnt/foo/bar
	root@mobil:/tmp/inotify-utils-0.25 # ./inotify_test /mnt/foo/bar &
	inotify device fd = 3
	/mnt/foo/bar WD=1
	[1] 8454
	root@mobil:/tmp/inotify-utils-0.25 # umount /dev/hda6
	read = 32
	sizeof inotify_event = 16
	pevent->len = 0
	pevent->len = 0
	EVENT ON WD=1
	DELETE_SELF (file) 0x00000400

	EVENT ON WD=1
	IGNORED (file) 0x00008000

	root@mobil:/tmp/inotify-utils-0.25 #

Juergen.