From: Oleg Drokin <green@namesys.com>
To: linux-kernel@vger.kernel.org
Cc: eazgwmir@umail.furryterror.org, viro@math.psu.edu, nikita@namesys.com
Subject: [2.4] VFS locking problem during concurrent link/unlink
Date: Thu, 16 Jan 2003 14:00:15 +0300 [thread overview]
Message-ID: <20030116140015.A17612@namesys.com> (raw)
Hello!
Debugging reiserfs problem that can be demonstrated with script created by
Zygo Blaxell, I started to wonder if the problem presented is indeed reiserfs
fault and not VFS.
Though the Zygo claims script only produces problems on reiserfs, I am trying
it now myself on ext2 (which will take some time).
Debugging shows that reiserfs_link is sometimes called for inodes whose
i_nlink is zero (and all corresponding data is deleted already).
So my current guess of what's going on is this:
process 1 process 2
sys_unlink("a/b") sys_link("a/b", "c/d");
down(inode of ("a")); down(inode of "c");
lock_kernel()
reiserfs_unlink("a/b")
decreases i_nlink of a/b to zero
and removes name "b" from "a"
unlock_kernel()
d_delete("a/b")
(*)
lock_kernel()
reiserfs_link()
at this point we do usual stuff,
but inode's n_nlink is zero and
file data already removed which
indicates reiserfs_delete_inode()
was already called at (*)
unlock_kernel()
So my question is "Is it really ok that sys_link/vfs_link does not
take semaphore on parent dir of original path?", or should we
actually put a workaround in reiserfs code to avoid such a situation?
Bye,
Oleg
PS: Here's the script:
#!/bin/bash
# Create an empty filesystem:
mkreiserfs -f -f /dev/hdb2
mount /dev/hdb2 /data1 -t reiserfs
cd /data1
# Script used to control the load average. Note that as written the loops
# below will keep spawning new processes, so we need some way to throttle
# them. Change the '-lt 10' to another number to change the number
# of processes.
cat <<'LC' > loadcheck && chmod 755 loadcheck
#!/bin/sh
read av1 av5 av15 rest < /proc/loadavg
echo -n "Load Average: $av1 ... "
av1=${av1%.*}
if [ $av1 -lt 10 ]; then
echo OK
exit 0
else
echo "Whoa, Nellie!"
exit 1
fi
LC
# Create directories used by test
mkdir foo bar
mkdir foo/etc foo/usr foo/var
# Start up some rsyncs. I use /etc, /usr, and /var because there's a
# good mixture of files with some hardlinks between them, and on a normal
# Linux system some of them change from time to time.
while sleep 1m; do
./loadcheck || continue;
for x in usr etc var; do
rsync -avxHS --delete /$x/. foo/$x/. &
done;
done &
# Start up some cp -al's and rm -rf's. Note there are two concurrent
# sets of 'cp's and two concurrent sets of 'rm's, and each of those
# has different instances of 'cp' and 'rm' running at different times.
for x in 1 2; do
while sleep 1m; do
./loadcheck || continue;
cp -al foo bar/`date +%s` &
done &
while sleep 1m; do
./loadcheck || continue;
for x in bar/*; do
rm -rf $x;
sleep 1m;
done &
done &
done &
next reply other threads:[~2003-01-16 10:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-16 11:00 Oleg Drokin [this message]
2003-01-16 15:39 ` [2.4] VFS locking problem during concurrent link/unlink Chris Mason
2003-01-16 15:43 ` Oleg Drokin
2003-01-16 16:02 ` Chris Mason
2003-01-16 16:06 ` Nikita Danilov
2003-01-16 16:22 ` Chris Mason
2003-01-16 17:03 ` Oleg Drokin
2003-01-16 17:20 ` Oleg Drokin
2003-01-16 16:07 ` Oleg Drokin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030116140015.A17612@namesys.com \
--to=green@namesys.com \
--cc=eazgwmir@umail.furryterror.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nikita@namesys.com \
--cc=viro@math.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.