You are not logged in.

#26 2013-04-25 14:10:06

niski
Member
Registered: 2012-09-09
Posts: 9

Re: Autochown: inotify-based file attribute manager

falconindy wrote:

inotify_add_watch returns ENOSPC when, to quote the manpage: "The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource.". You can modify this value by writing to /proc/sys/fs/inotify/max_user_watches, but there is a hard limit, and every watch consumes kernel resources.

Thanks for the explanation, I'll stick to watching most important projects then.

Offline

#27 2013-04-25 20:28:09

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Autochown: inotify-based file attribute manager

niski wrote:

Thanks for the explanation, I'll stick to watching most important projects then.

You could create a cronjob to run "autochown -e ..." periodically on large directory hierarchies if you do not need real-time modifications. The "-e" option skips the watchlist entirely so the size limitation is lifted.* In your case you could do both, with one input file to watch the active directories and another to create a cronjob for the rest.




* There may be a recursion limit due to directory depth. I don't remember how I implemented that right now, but if someone reaches that limit in a real-world scenario then I will try to refactor the code (if I haven't done so already).


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#28 2013-04-25 22:02:43

niski
Member
Registered: 2012-09-09
Posts: 9

Re: Autochown: inotify-based file attribute manager

Xyne wrote:

You could create a cronjob to run "autochown -e ..." periodically on large directory hierarchies if you do not need real-time modifications. The "-e" option skips the watchlist entirely so the size limitation is lifted.* In your case you could do both, with one input file to watch the active directories and another to create a cronjob for the rest.

I've just tested -e switch on other machine with larger directory tree, works without a hitch. Thanks.
I don't mind having it executed less often as long as I won't have to chown and chmod every new file I add to any of those subprojects manually - simply because I often forget to update ownership and later waste my time finding the culprit of failing file operations.

Offline

#29 2013-10-15 12:28:59

pinball-fixer
Member
Registered: 2013-10-15
Posts: 2

Re: Autochown: inotify-based file attribute manager

I Just had this error happen recently...

As there is 20Gb available on the drive, it took me a while to figure out what was going on - until I found this forum.

Admittedly, the location that it is happening on is not a frequently modified directory, so I can use the crontab solution. But I suppose for ease of use it would be nice if this error didn't come up at all.

My error is as follows:
Oct 02 20:02:36 server autochown[29803]: error: failed to add watch (/home/***/***/arcade/Video Games/***/***/***/dlc/03_character/battle/hud/SPA/RIC) [No space left on device]
(I have edited some of the directory structure as I don't want the exact names available to the world... but have left "***" in place so that the whole line is there.)

I will remove this particular directory structure from the autochown config file, but it would be great if this was added into the program so it is easy to implement.

Kind Regards, Pinball-Fixer

Offline

#30 2013-10-15 13:11:41

progandy
Member
Registered: 2012-05-17
Posts: 5,180

Re: Autochown: inotify-based file attribute manager

For a large directory structure you could also try to create a fuse bindmount that enforces specific permissions if you don't mind the performance penalty. (e.g. bindfs.org, --force-group, --force-user, --perms=permissions, and more)

Last edited by progandy (2013-10-15 13:17:54)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#31 2013-10-17 23:51:34

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Autochown: inotify-based file attribute manager

@pinball-fixer
Ignoring watch list errors after it hits the limit would lead to bad behavior. How would the user know which target directories have been omitted? Warning messages? The user would then have to constantly monitor the output for new directories created in the watched directories. Overall, if a user is expecting a hierarchy to be autochowned in realtime then it should not ignore errors. If realtime management is not an issue then running it periodically with "-e" or ignoring quasi-static directories is the right solution.

If you really want it to ignore those errors, open up main.c and change the "die" statement on line 475 to something else:

    wd = inotify_add_watch(INOTIFY_INSTANCE, path, EVENTS);
    if (wd == -1)
    {
      die("error: failed to add watch (%s)", path);
    }

For example:

    wd = inotify_add_watch(INOTIFY_INSTANCE, path, EVENTS);
    if (wd == -1)
    {
      fprintf(stderr, "error: failed to add watch (%s)", path);
    }

My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB