[Unionfs] Locking issue with unionfs
Olivier Blin
blino at mandriva.com
Mon Oct 29 11:23:50 EDT 2007
Erez Zadok <ezk at cs.sunysb.edu> writes:
>> Looking at above, we can see that unionfs is locked at unionfs_lookup,
>> probably at "unionfs_read_lock(sb);". Then if you analyze the stack trace
>> above looking at the other unionfs functions, you discover that in
>> unionfs_remount_fs there is a "unionfs_write_lock(sb)", and because this the
>> deadlock happens. I made a patch that at least seems to have worked here on a
>> quick test as a workaround, I don't know yet if it has some side effect or if
>> could be the proper fix for this locking issue, here it's the patch:
>>
>> --- linux-2.6.22.10-0.2mdv/fs/unionfs/super.c 2007-10-18
>> 17:11:39.000000000 -0200
>> +++ linux-2.6.22.10-0.2mdv.mod/fs/unionfs/super.c 2007-10-18
>> 16:56:39.000000000 -0200
>> @@ -587,10 +587,12 @@ static int unionfs_remount_fs(struct sup
>> }
>>
>> if (!strcmp("add", optname)) {
>> + unionfs_write_unlock(sb);
>> err = do_remount_add_option(optarg, new_branches,
>> tmp_data,
>> tmp_lower_paths,
>> &new_high_branch_id);
>> + unionfs_write_lock(sb);
>> if (err)
>> goto out_release;
>> new_branches++;
>>
>> I just unlock temporarily sb, probably not the right fix, as I didn't
>> understand well the locking scheme yet.
>
> Herton, your fix is probably ok in the short term. I'm looking into a way
> to solve this deadlock more cleanly. It's not easy b/c a read-write
> semaphore in linux has no easy way to allow the same lock-owner who holds
> the write lock, to also get a readlock.
Of course, the same is valid for mode/del operations:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unionfs-2.1.6-mode-del-lock.patch
Type: text/x-patch
Size: 659 bytes
Desc: temporarily unlock sb for mode/del operations
Url : http://www.fsl.cs.sunysb.edu/pipermail/unionfs/attachments/20071029/4ef57762/unionfs-2.1.6-mode-del-lock.bin
-------------- next part --------------
--
Olivier Blin (blino) - Mandriva
More information about the unionfs
mailing list