Re: [PATCH v3 3/6] btrfs: add scrub code and prototypes

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

 



On 17.03.2011 00:10, Arne Jansen wrote:
On 16.03.2011 23:07, Andi Kleen wrote:
Arne Jansen<sensille@xxxxxxx>  writes:
+     */
+    mutex_lock(&fs_info->scrub_lock);
+    atomic_inc(&fs_info->scrubs_running);
+    mutex_unlock(&fs_info->scrub_lock);
It seems odd to protect an atomic_inc with a mutex.
Is that done for some side effect? Otherwise you either
don't need atomic or don't need the lock.

The reason it is atomic is because it is checked inside a wait_event,
where I can't hold a lock. The mutex is there to protect the check
in btrfs_scrub_pause and btrfs_scrub_cancel. But, now that I think
of it, there is still a race condition left. I'll rethink the locking there
and see if I can eliminate some of the mutex_locks.
On third look I can't find the race condition I thought was there...
Just removing the locks around most inc/dec looks ok.

Thanks,
Arne
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux