[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: reading an empty directory after reboot is very slow



On 2015-04-20 13:04:41 -0500, David Wright wrote:
> Quoting Vincent Lefevre (vincent@vinc17.net):
> > But with the current solution (no automatic moving of an entry), you
> > can't miss an entry that hasn't been removed.
> 
> $ mkdir /tmp/testdir
> ~ $ mkdir /tmp/testdir/file1
> ~ $ mkdir /tmp/testdir/file2
> ~ $ mkdir /tmp/testdir/file3
> ~ $ mkdir /tmp/testdir/file4
> ~ $ mkdir /tmp/testdir/file5
> ~ $ ls -lU /tmp/testdir/
> total 20
> drwxr-x--- 2 david david 4096 Apr 20 12:53 file1
> drwxr-x--- 2 david david 4096 Apr 20 12:54 file4
> drwxr-x--- 2 david david 4096 Apr 20 12:54 file5
> drwxr-x--- 2 david david 4096 Apr 20 12:54 file2
> drwxr-x--- 2 david david 4096 Apr 20 12:54 file3
> ~ $ mv -i /tmp/testdir/file4 /tmp/testdir/file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4
> ~ $ ls -lU /tmp/testdir/
> total 20
> drwxr-x--- 2 david david 4096 Apr 20 12:53 file1
> drwxr-x--- 2 david david 4096 Apr 20 12:54 file5
> drwxr-x--- 2 david david 4096 Apr 20 12:54 file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4file4
> drwxr-x--- 2 david david 4096 Apr 20 12:54 file2
> drwxr-x--- 2 david david 4096 Apr 20 12:54 file3
> ~ $ 
> 
> ...so if you happen to be reading the entry for file5 at the
> time I typed mv, you'll get the entry for file4 twice, under
> two different names. (Or the opposite.)

OK, so, if the rename(2) system call can reorder the entries (this is
not quite clear because one doesn't see the empty entries here), then
there is already a problem with the file system. Getting an entry
twice under different names is not much a problem, IMHO, because one
can look at the inode number; there's a race condition, but at worst,
one can just miss a *new* inode (whose number has been reassigned).
Missing an existing entry is a problem.

What do the backup systems do?

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: