Commit 37a734c1 authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: Fix race between link() and unlink()

JFS isn't happy it thinks a file has been removed, and link() increases
its nlink count back from zero.  In 2.4, i_zombie prevented this race
condition.

http://bugzilla.kernel.org/show_bug.cgi?id=866
parent bdf29b0a
......@@ -772,16 +772,17 @@ int jfs_link(struct dentry *old_dentry,
jfs_info("jfs_link: %s %s", old_dentry->d_name.name,
dentry->d_name.name);
if (ip->i_nlink == JFS_LINK_MAX)
return -EMLINK;
if (ip->i_nlink == 0)
return -ENOENT;
tid = txBegin(ip->i_sb, 0);
down(&JFS_IP(dir)->commit_sem);
down(&JFS_IP(ip)->commit_sem);
if (ip->i_nlink == JFS_LINK_MAX) {
rc = -EMLINK;
goto out;
}
/*
* scan parent directory for entry/freespace
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment