A
A
Anton Ivanov2012-12-17 23:02:34
linux
Anton Ivanov, 2012-12-17 23:02:34

Incorrect (weird) behavior of inotify on Synology NAS?


I have a Synology DS212j with DS 4.1 installed.
Minidlna media server version 1.0.25 is installed (built from source) and strange inotify behavior is observed when uploading files from a macbook.
Tested with MacBook Pro 15" (OSX 10.8), MacBook Pro 15" Retina (OSX 10.8) and MacBook Air 13" (OSX 10.7.5)
When copying files to disk storage from a macbook, via Finder, minidlna constantly (while the file is being copied) receives an IN_CLOSE_WRITE event. To receive each such event, a new file is written to the database. It turns out that by uploading 3-4 files, we get several dozen instances of each of these files in the media server database. When downloading from Windows, via Total Commander, minidlna receives an IN_CLOSE_WRITE event once for each file, about 1-2 seconds after copying is complete.
The inotify FAQ says:

Q: What is the difference between IN_MODIFY and IN_CLOSE_WRITE?
The IN_MODIFY event is emitted on a file content change (eg via the write() syscall) while IN_CLOSE_WRITE occurs on closing the changed file. It means each change operation causes one IN_MODIFY event (it may occur many times during manipulations with an open file) whereas IN_CLOSE_WRITE is emitted only once (on closing the file).

It turns out that when copying from a macbook, IN_CLOSE_WRITE is called instead of IN_MODIFY. But what's the difference when copying from Windows? After all, inotify is a disk storage kernel subsystem.
The processor on the DS212j is ARM.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evengard, 2012-12-17
@Evengard

I can’t say for sure, but it’s possible that the matter is how the macbook copies files. Opens a small piece, copies, closes the file, puts them together. Then it repeats again and again until the entire file is bypassed in this way.
And Windows opens the file once and reads it all slowly.
Just the peculiarities of how different systems download files. Although, IMHO, the MacBook option seems suboptimal to me personally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question