HomeFreeBSD

Fix casesensitivity=insensitive deadlock

Description

Fix casesensitivity=insensitive deadlock

When casesensitivity=insensitive is set for the
file system, we can deadlock in a rename if the user uses different case
for each path. For example rename("A/some-file.txt", "a/some-file.txt").

The simple test for this is:

  1. mkdir some-dir in a ZFS file system
  2. touch some-dir/some-file.txt
  3. mv Some-dir/some-file.txt some-dir/some-other-file.txt

This last request deadlocks trying to relock the i_mutex on the inode for
the parent directory.

The solution is to use d_add_ci in zpl_lookup if we are on a file system
that has the casesensitivity=insensitive attribute set.

This patch checks if we are working on a case insensitive file system and if
so, allocates storage for the case insensitive name and passes it to
zfs_lookup and then calls d_add_ci instead of d_splice_alias.

The performance impact seems to be minimal even though we have introduced a
kmalloc and kfree in the lookup path.

The problem was found when running Microsoft's FSCT against Samba on top of
ZFS On Linux.

Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4136

Details

Provenance
Richard Sharpe <rsharpe@samba.org>Authored on Dec 28 2015, 12:08 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jan 8 2016, 7:05 PM
Parents
rG7cf2ffa02065: Make arc_summary.py and dbufstat.py compatible with python3
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGc5d028701167: Fix casesensitivity=insensitive deadlock (authored by Richard Sharpe <rsharpe@samba.org>).Jan 8 2016, 7:05 PM