I decided to strace claws-mail. The first thing it does to trigger an automount is an open on the directory:
18672 13:17:53.843597 open("/misc/salusa/scratch", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC <unfinished ...>
...while that crunching away, a different thread does an lstat of a file in that directory (the one it intends to save):
18682 13:17:53.975947 lstat("/misc/salusa/scratch/[CapitalCityCigars] And so it begins!!", <unfinished ...>
...that comes back first:
18682 13:17:54.301130 <... lstat resumed> 0x7f7baea2a910) = -1 ENOENT (No such file or directory) <0.325145>
...then it does an lstat of the parent:
18682 13:17:54.303366 lstat("/misc/salusa/scratch", {st_dev=makedev(0, 42), st_ino=2, st_mode=S_IFDIR|S_ISVTX|0777, st_nlink=8, st_uid=99, st_gid=99, st_blksize=524288, st_blocks=8, st_size=4096, st_atime=2011/06/07-12:13:09, st_mtime=2011/06/07-12:13:09, st_ctime=2011/06/07-12:13:09}) = 0 <0.000390>
...a little later, the opendir returns:
18672 13:17:54.340699 <... open resumed> ) = 23 <0.497070>
...then it sets an inotify watch (probably via some gtk open dialog goop):
18668 13:17:54.341626 inotify_add_watch(21, "/misc/salusa/scratch", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = 3 <0.000043>
...and then starts a readdir:
18682 13:17:54.342309 getdents(23, <unfinished ...>
...that comes back (I won't paste it as it's pretty big), and then it starts lstat'ing each dentry:
18682 13:17:54.347897 lstat("/misc/salusa/scratch/testfile", {st_dev=makedev(0, 42), st_ino=13, st_mode=S_IFREG|0644, st_nlink=1, st_uid=99, st_gid=99, st_blksize=524288, st_blocks=2097160, st_si ze=1073741824, st_atime=2011/05/19-10:56:52, st_mtime=2011/05/19-10:59:30, st_ctime=2011/05/19-10:59:30}) = 0 <0.000033>
...most of this is pretty straightforward stuff, but I wonder if the inotify_add_watch is important somehow as that's somewhat unusual from command-line apps.
I decided to strace claws-mail. The first thing it does to trigger an automount is an open on the directory:
18672 13:17:53.843597 open("/ misc/salusa/ scratch" , O_RDONLY| O_NONBLOCK| O_DIRECTORY| O_CLOEXEC <unfinished ...>
...while that crunching away, a different thread does an lstat of a file in that directory (the one it intends to save):
18682 13:17:53.975947 lstat(" /misc/salusa/ scratch/ [CapitalCityCig ars] And so it begins!!", <unfinished ...>
...that comes back first:
18682 13:17:54.301130 <... lstat resumed> 0x7f7baea2a910) = -1 ENOENT (No such file or directory) <0.325145>
...then it does an lstat of the parent:
18682 13:17:54.303366 lstat(" /misc/salusa/ scratch" , {st_dev=makedev(0, 42), st_ino=2, st_mode= S_IFDIR| S_ISVTX| 0777, st_nlink=8, st_uid=99, st_gid=99, st_blksize=524288, st_blocks=8, st_size=4096, 2011/06/ 07-12:13: 09, st_mtime= 2011/06/ 07-12:13: 09, st_ctime= 2011/06/ 07-12:13: 09}) = 0 <0.000390>
st_atime=
...a little later, the opendir returns:
18672 13:17:54.340699 <... open resumed> ) = 23 <0.497070>
...then it sets an inotify watch (probably via some gtk open dialog goop):
18668 13:17:54.341626 inotify_ add_watch( 21, "/misc/ salusa/ scratch" , IN_MODIFY| IN_ATTRIB| IN_CLOSE_ WRITE|IN_ MOVED_FROM| IN_MOVED_ TO|IN_CREATE| IN_DELETE| IN_DELETE_ SELF|IN_ MOVE_SELF| IN_UNMOUNT| IN_ONLYDIR) = 3 <0.000043>
...and then starts a readdir:
18682 13:17:54.342309 getdents(23, <unfinished ...>
...that comes back (I won't paste it as it's pretty big), and then it starts lstat'ing each dentry:
18682 13:17:54.347897 lstat(" /misc/salusa/ scratch/ testfile" , {st_dev=makedev(0, 42), st_ino=13, st_mode= S_IFREG| 0644, st_nlink=1, st_uid=99, st_gid=99, st_blksize=524288, st_blocks=2097160, st_si 2011/05/ 19-10:56: 52, st_mtime= 2011/05/ 19-10:59: 30, st_ctime= 2011/05/ 19-10:59: 30}) = 0 <0.000033>
ze=1073741824, st_atime=
...most of this is pretty straightforward stuff, but I wonder if the inotify_add_watch is important somehow as that's somewhat unusual from command-line apps.