diff options
author | Vaughan Cao <vaughan.cao@oracle.com> | 2013-08-29 10:00:36 +0800 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-09-03 07:28:09 -0700 |
commit | 15b06f9a02406e5460001db6d5af5c738cd3d4e7 (patch) | |
tree | a62209c714df581942342acb0a167889fe2e25da /arch/arm/mach-sunxi | |
parent | a027b5b90eb6b5ec5c5890a5e4e198f458ae94cb (diff) |
[SCSI] sg: use rwsem to solve race during exclusive open
A race condition may happen if two threads are both trying to open the same sg
with O_EXCL simultaneously. It's possible that they both find fsds list is
empty and get_exclude(sdp) returns 0, then they both call set_exclude() and
break out from wait_event_interruptible and resume open.
Now use rwsem to protect this process. Exclusive open gets write lock and
others get read lock. The lock will be held until file descriptor is closed.
This also leads 'exclude' only a status rather than a check mark.
Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'arch/arm/mach-sunxi')
0 files changed, 0 insertions, 0 deletions