[PATCH] hv: hypervvssd: call endmntent before call setmntent again

2015-03-17 Thread Vaughan Cao
If freeze fails, vss_operate will re-enter itself to thaw. But it forgets to call endmntent() before it recalls setmntent() again. Signed-off-by: Vaughan Cao --- tools/hv/hv_vss_daemon.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/hv/hv_vss_daemon.c b

[PATCH] hv: hypervvssd: call endmntent before call setmntent again

2015-03-17 Thread Vaughan Cao
If freeze fails, vss_operate will re-enter itself to thaw. But it forgets to call endmntent() before it recalls setmntent() again. Signed-off-by: Vaughan Cao vaughan@oracle.com --- tools/hv/hv_vss_daemon.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools

[PATCH v2] notify block layer when using temporary change to cache_type

2014-06-03 Thread Vaughan Cao
ted. This patch factors out a helper that can be called from sd_revalidate_disk and cache_type_store. Signed-off-by: Vaughan Cao --- drivers/scsi/sd.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index efcb

[PATCH v2] notify block layer when using temporary change to cache_type

2014-06-03 Thread Vaughan Cao
. This patch factors out a helper that can be called from sd_revalidate_disk and cache_type_store. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sd.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi

Re: [PATCH] notify block layer when using temporary change to cache_type

2014-05-27 Thread Vaughan Cao
On 05/28/2014 12:18 AM, James Bottomley wrote: > On Tue, 2014-05-27 at 19:39 +0800, Vaughan Cao wrote: >> This is a fix for commit: >> 39c60a0948cc06139e2fbfe084f83cb7e7deae3b sd: fix array cache flushing bug >> causing performance problems >> We must notify the blo

[PATCH] notify block layer when using temporary change to cache_type

2014-05-27 Thread Vaughan Cao
ted. Signed-off-by: Vaughan Cao --- drivers/scsi/sd.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 6146b9d..366e48b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -144,6 +144,7 @@ sd_store_cache_type(struct device *dev, str

[PATCH] notify block layer when using temporary change to cache_type

2014-05-27 Thread Vaughan Cao
. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sd.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 6146b9d..366e48b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -144,6 +144,7 @@ sd_store_cache_type

Re: [PATCH] notify block layer when using temporary change to cache_type

2014-05-27 Thread Vaughan Cao
On 05/28/2014 12:18 AM, James Bottomley wrote: On Tue, 2014-05-27 at 19:39 +0800, Vaughan Cao wrote: This is a fix for commit: 39c60a0948cc06139e2fbfe084f83cb7e7deae3b sd: fix array cache flushing bug causing performance problems We must notify the block layer via q-flush_flags after

[PATCH] remove duplicate checking code

2014-05-16 Thread Vaughan Cao
amd_iommu_rlookup_table[devid] != NULL is already guaranteed by check_device called before, it's fine to attach device at this point. Signed-off-by: Vaughan Cao --- drivers/iommu/amd_iommu.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu

[PATCH] remove duplicate checking code

2014-05-16 Thread Vaughan Cao
amd_iommu_rlookup_table[devid] != NULL is already guaranteed by check_device called before, it's fine to attach device at this point. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/iommu/amd_iommu.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/iommu/amd_iommu.c

[PATCH] iscsi: fix wrong order of opcode and itt in iscsi_handle_reject prompt

2014-01-08 Thread Vaughan Cao
This patch makes reject messages show right value for opcode and itt, which is converse previously. Signed-off-by: Vaughan Cao --- drivers/scsi/libiscsi.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index e399561

[PATCH] iscsi: fix wrong order of opcode and itt in iscsi_handle_reject prompt

2014-01-08 Thread Vaughan Cao
This patch makes reject messages show right value for opcode and itt, which is converse previously. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/libiscsi.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi

Re: [PATCH] async: fix insert entry in ascending list

2013-12-18 Thread Vaughan Cao
On 2013年12月18日 20:25, Tejun Heo wrote: Hello, On Wed, Dec 18, 2013 at 11:15:23AM +0800, Vaughan Cao wrote: I suppose there is a fault in the patch of https://lkml.org/lkml/2013/1/16/546. I know you made a new patch for latest kernel which don't move the entry between pending and running list

Re: PROBLEM: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle

2013-12-18 Thread Vaughan Cao
On 2013年10月21日 14:07, vaughan wrote: On 10/16/2013 02:52 PM, Hannes Reinecke wrote: But seeing that this approach raises quite some issues I've attached a different patch. Vaughan, could you test with that, too? Should be functionally equivalent to the previous one. Cheers, Hannes Hi Hannes,

Re: PROBLEM: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle

2013-12-18 Thread Vaughan Cao
On 2013年10月21日 14:07, vaughan wrote: On 10/16/2013 02:52 PM, Hannes Reinecke wrote: But seeing that this approach raises quite some issues I've attached a different patch. Vaughan, could you test with that, too? Should be functionally equivalent to the previous one. Cheers, Hannes Hi Hannes,

Re: [PATCH] async: fix insert entry in ascending list

2013-12-18 Thread Vaughan Cao
On 2013年12月18日 20:25, Tejun Heo wrote: Hello, On Wed, Dec 18, 2013 at 11:15:23AM +0800, Vaughan Cao wrote: I suppose there is a fault in the patch of https://lkml.org/lkml/2013/1/16/546. I know you made a new patch for latest kernel which don't move the entry between pending and running list

[PATCH] iscsi: conn error (1020) each time iscsi session logout

2013-12-17 Thread Vaughan Cao
it by checking session state and err value accordingly. Signed-off-by: Vaughan Cao --- drivers/scsi/libiscsi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 415f2c0..84171ef 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi

[PATCH] async: fix insert entry in ascending list

2013-12-17 Thread Vaughan Cao
to find a larger cookie and insert itself before that node, it won't result in a sorted list in any direction... I don't know if my understanding about the async mechanism is right, so here to have a check with you. Thanks. Signed-off-by: Vaughan Cao --- kernel/async.c | 4 ++-- 1 file changed, 2

[PATCH] async: fix insert entry in ascending list

2013-12-17 Thread Vaughan Cao
to find a larger cookie and insert itself before that node, it won't result in a sorted list in any direction... I don't know if my understanding about the async mechanism is right, so here to have a check with you. Thanks. Signed-off-by: Vaughan Cao vaughan@oracle.com --- kernel/async.c | 4

[PATCH] iscsi: conn error (1020) each time iscsi session logout

2013-12-17 Thread Vaughan Cao
it by checking session state and err value accordingly. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/libiscsi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 415f2c0..84171ef 100644 --- a/drivers/scsi/libiscsi.c

[PATCH] [SCSI] scsi_dh_alua: restrain retries during AAS transition period

2013-11-22 Thread Vaughan Cao
ce degradation. Ideally, one would want the host to perform restrained retries during this transitioning period in all relevant code paths including the alua_rtpg routine. Restrain retries in the same way already implemented when state = TPGS_STATE_TRANSITIONING is returned by extended RTPG. Signed-off-b

[PATCH] [SCSI] scsi_dh_alua: restrain retries during AAS transition period

2013-11-22 Thread Vaughan Cao
. Ideally, one would want the host to perform restrained retries during this transitioning period in all relevant code paths including the alua_rtpg routine. Restrain retries in the same way already implemented when state = TPGS_STATE_TRANSITIONING is returned by extended RTPG. Signed-off-by: Vaughan

[PATCH] iscsi: quiesce connection error event during logout

2013-11-21 Thread Vaughan Cao
'connectionX:X: detected conn error(1020)' message appear during normal logout phase because of connection close on target peer. Quiesce it to avoid confusion. Signed-off-by: Vaughan Cao --- drivers/scsi/libiscsi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi

[PATCH] iscsi: quiesce connection error event during logout

2013-11-21 Thread Vaughan Cao
'connectionX:X: detected conn error(1020)' message appear during normal logout phase because of connection close on target peer. Quiesce it to avoid confusion. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/libiscsi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-11-03 Thread Vaughan Cao
On 2013年11月03日 02:22, Douglas Gilbert wrote: On 13-11-01 01:16 AM, vaughan wrote: I do not follow the last point but that is not important. For reasons that I listed in a private post I think that my patch presented in this thread is closer to our goals than your patch (2013/6/17/319).

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-11-03 Thread Vaughan Cao
On 2013年11月03日 02:22, Douglas Gilbert wrote: On 13-11-01 01:16 AM, vaughan wrote: I do not follow the last point but that is not important. For reasons that I listed in a private post I think that my patch presented in this thread is closer to our goals than your patch (2013/6/17/319).

Re: [PATCH] [SCSI] sg: late O_EXCL fix for lk 3.12-rc

2013-10-21 Thread Vaughan Cao
On 2013年10月21日 07:00, Douglas Gilbert wrote: On 13-10-20 01:31 PM, Bart Van Assche wrote: On 10/20/13 18:09, Douglas Gilbert wrote: Given that lk 3.12.0 release is not far away, the safest path may still be to revert Vaughan Cao's patch. I'll leave that decision to the maintainers. Hello

Re: [PATCH] [SCSI] sg: late O_EXCL fix for lk 3.12-rc

2013-10-21 Thread Vaughan Cao
On 2013年10月21日 07:00, Douglas Gilbert wrote: On 13-10-20 01:31 PM, Bart Van Assche wrote: On 10/20/13 18:09, Douglas Gilbert wrote: Given that lk 3.12.0 release is not far away, the safest path may still be to revert Vaughan Cao's patch. I'll leave that decision to the maintainers. Hello

Re: PROBLEM: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle

2013-10-15 Thread Vaughan Cao
On 2013年10月15日 13:51, Hannes Reinecke wrote: But that notwithstanding, did you get a chance to test my patch? Cheers, Hannes Hi Hannes, Kernel patched and waiting feedback from lab guy. Thanks, Vaughan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body

Re: PROBLEM: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle

2013-10-15 Thread Vaughan Cao
On 2013年10月15日 13:51, Hannes Reinecke wrote: But that notwithstanding, did you get a chance to test my patch? Cheers, Hannes Hi Hannes, Kernel patched and waiting feedback from lab guy. Thanks, Vaughan -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of

Re: PROBLEM: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle

2013-10-14 Thread Vaughan Cao
On 2013年10月14日 21:18, Hannes Reinecke wrote: On 10/14/2013 02:51 PM, Steffen Maier wrote: Hi Hannes, On 10/14/2013 01:13 PM, Hannes Reinecke wrote: On 10/13/2013 07:23 PM, Vaughan Cao wrote: Hi James, [1.] One line summary of the problem: special sense code asc,ascq=04h,0Ch abort scsi scan

Re: PROBLEM: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle

2013-10-14 Thread Vaughan Cao
On 2013年10月14日 21:18, Hannes Reinecke wrote: On 10/14/2013 02:51 PM, Steffen Maier wrote: Hi Hannes, On 10/14/2013 01:13 PM, Hannes Reinecke wrote: On 10/13/2013 07:23 PM, Vaughan Cao wrote: Hi James, [1.] One line summary of the problem: special sense code asc,ascq=04h,0Ch abort scsi scan

PROBLEM: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle

2013-10-13 Thread Vaughan Cao
Hi James, [1.] One line summary of the problem: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle [2.] Full description of the problem/report: For instance, storage represents 8 iscsi LUNs, however the LUN No.7 is not well configured or has something wrong. Then messages

PROBLEM: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle

2013-10-13 Thread Vaughan Cao
Hi James, [1.] One line summary of the problem: special sense code asc,ascq=04h,0Ch abort scsi scan in the middle [2.] Full description of the problem/report: For instance, storage represents 8 iscsi LUNs, however the LUN No.7 is not well configured or has something wrong. Then messages

[PATCH v2] block: register_blkdev doesn't check name against NULL

2013-09-10 Thread Vaughan Cao
register_blkdev(0, NULL) can result kernel Oops by copying from NULL in strlcpy(). Fix it by checking NULL pointer at the beginning and WARN when encountered in unregister_blkdev. Signed-off-by: Vaughan Cao --- block/genhd.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

[PATCH] block: register_blkdev doesn't check name against NULL

2013-09-10 Thread Vaughan Cao
register_blkdev(0, NULL) can result kernel Oops by copying from NULL in strlcpy(). Fix it by checking NULL pointer at the beginning. Signed-off-by: Vaughan Cao --- block/genhd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/genhd.c b/block/genhd.c index dadf42b..9564f19 100644

[PATCH] block: register_blkdev doesn't check name against NULL

2013-09-10 Thread Vaughan Cao
register_blkdev(0, NULL) can result kernel Oops by copying from NULL in strlcpy(). Fix it by checking NULL pointer at the beginning. Signed-off-by: Vaughan Cao vaughan@oracle.com --- block/genhd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/genhd.c b/block/genhd.c index

[PATCH v2] block: register_blkdev doesn't check name against NULL

2013-09-10 Thread Vaughan Cao
register_blkdev(0, NULL) can result kernel Oops by copying from NULL in strlcpy(). Fix it by checking NULL pointer at the beginning and WARN when encountered in unregister_blkdev. Signed-off-by: Vaughan Cao vaughan@oracle.com --- block/genhd.c | 5 - 1 file changed, 4 insertions(+), 1

[PATCH v7 1/4] sg: use rwsem to solve race during exclusive open

2013-08-28 Thread Vaughan Cao
insane code dealing with sg_add_sfp. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 79 +-- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index df5e961..4efa9b5 100644 --- a/drivers/scsi

[PATCH v7 2/4] sg: no need sg_open_exclusive_lock

2013-08-28 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git

[PATCH v7 0/4][SCSI] sg: fix race condition in sg_open

2013-08-28 Thread Vaughan Cao
from v3: * release o_sem in sg_release(), not in sg_remove_sfp(). * not set exclude with sfd_lock held. Vaughan Cao (4): sg: use rwsem to solve race during exclusive open sg: no need sg_open_exclusive_lock sg: checking sdp->detached isn't protected when open sg: push file descriptor l

[PATCH v7 4/4] sg: push file descriptor list locking down to per-device locking

2013-08-28 Thread Vaughan Cao
ict in cherrry-pick. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 62 ++- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 64df1ab..5cbc4bb 100644 --- a/drivers/scsi/sg.c +++ b/drivers/s

[PATCH v7 3/4] sg: checking sdp->detached isn't protected when open

2013-08-28 Thread Vaughan Cao
. Changes from v4: * use ERR_PTR series instead of adding another parameter in sg_add_sfp Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index d4af132..64df1ab 100644

[PATCH v6 3/4] sg: checking sdp->detached isn't protected when open

2013-08-28 Thread Vaughan Cao
series instead of adding another parameter in sg_add_sfp Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index dcbd95f..6bffe52 100644 --- a/drivers/scsi/sg.c +++ b

[PATCH v6 1/4] sg: use rwsem to solve race during exclusive open

2013-08-28 Thread Vaughan Cao
. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 83 +-- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index df5e961..7a54c92 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -170,11

[PATCH v6 2/4] sg: no need sg_open_exclusive_lock

2013-08-28 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git

[PATCH v6 4/4] sg: push file descriptor list locking down to per-device locking

2013-08-28 Thread Vaughan Cao
ict in cherrry-pick. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 62 ++- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 6bffe52..10d6943 100644 --- a/drivers/scsi/sg.c +++ b/drivers/s

[PATCH v6 0/4][SCSI] sg: fix race condition in sg_open

2013-08-28 Thread Vaughan Cao
(). * not set exclude with sfd_lock held. Vaughan Cao (4): sg: use rwsem to solve race during exclusive open sg: no need sg_open_exclusive_lock sg: checking sdp->detached isn't protected when open sg: push file descriptor list locking down to per-device locking drivers/scsi/sg.c |

[PATCH v6 0/4][SCSI] sg: fix race condition in sg_open

2013-08-28 Thread Vaughan Cao
(). * not set exclude with sfd_lock held. Vaughan Cao (4): sg: use rwsem to solve race during exclusive open sg: no need sg_open_exclusive_lock sg: checking sdp-detached isn't protected when open sg: push file descriptor list locking down to per-device locking drivers/scsi/sg.c | 173

[PATCH v6 4/4] sg: push file descriptor list locking down to per-device locking

2013-08-28 Thread Vaughan Cao
-pick. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 62 ++- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 6bffe52..10d6943 100644 --- a/drivers/scsi/sg.c

[PATCH v6 2/4] sg: no need sg_open_exclusive_lock

2013-08-28 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29

[PATCH v6 1/4] sg: use rwsem to solve race during exclusive open

2013-08-28 Thread Vaughan Cao
. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 83 +-- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index df5e961..7a54c92 100644 --- a/drivers/scsi/sg.c +++ b

[PATCH v6 3/4] sg: checking sdp-detached isn't protected when open

2013-08-28 Thread Vaughan Cao
series instead of adding another parameter in sg_add_sfp Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index dcbd95f..6bffe52 100644 --- a/drivers

[PATCH v7 0/4][SCSI] sg: fix race condition in sg_open

2013-08-28 Thread Vaughan Cao
from v3: * release o_sem in sg_release(), not in sg_remove_sfp(). * not set exclude with sfd_lock held. Vaughan Cao (4): sg: use rwsem to solve race during exclusive open sg: no need sg_open_exclusive_lock sg: checking sdp-detached isn't protected when open sg: push file descriptor list

[PATCH v7 4/4] sg: push file descriptor list locking down to per-device locking

2013-08-28 Thread Vaughan Cao
-pick. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 62 ++- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 64df1ab..5cbc4bb 100644 --- a/drivers/scsi/sg.c

[PATCH v7 3/4] sg: checking sdp-detached isn't protected when open

2013-08-28 Thread Vaughan Cao
. Changes from v4: * use ERR_PTR series instead of adding another parameter in sg_add_sfp Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index d4af132

[PATCH v7 2/4] sg: no need sg_open_exclusive_lock

2013-08-28 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29

[PATCH v7 1/4] sg: use rwsem to solve race during exclusive open

2013-08-28 Thread Vaughan Cao
insane code dealing with sg_add_sfp. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 79 +-- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index df5e961..4efa9b5

[PATCH] xen: initialize xen panic handler for PVHVM

2013-08-16 Thread Vaughan Cao
- SHUTDOWN_crash. xen_panic_handler_init() is defined to register on panic_notifier_list but we only call it in xen_arch_setup which only be called by pvm, this patch is necessary for pvhvm. Signed-off-by: Vaughan Cao --- arch/x86/xen/enlighten.c | 2 ++ 1 file changed, 2 insertions(+) diff

[PATCH] xen: initialize xen panic handler for PVHVM

2013-08-16 Thread Vaughan Cao
code - SHUTDOWN_crash. xen_panic_handler_init() is defined to register on panic_notifier_list but we only call it in xen_arch_setup which only be called by pvm, this patch is necessary for pvhvm. Signed-off-by: Vaughan Cao vaughan@oracle.com --- arch/x86/xen/enlighten.c | 2 ++ 1 file changed

[PATCH v5 0/4] [SCSI] sg: fix race condition in sg_open

2013-07-21 Thread Vaughan Cao
(), not in sg_remove_sfp(). * not set exclude with sfd_lock held. Vaughan Cao (4): [SCSI] sg: use rwsem to solve race during exclusive open [SCSI] sg: no need sg_open_exclusive_lock [SCSI] sg: checking sdp->detached isn't protected when open [SCSI] sg: push file descriptor list locking d

[PATCH v5 1/4] [SCSI] sg: use rwsem to solve race during exclusive open

2013-07-21 Thread Vaughan Cao
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 --- drivers/scsi/sg.c | 77

[PATCH v5 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-21 Thread Vaughan Cao
in sg_add_sfp Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 671b760..f0e4785 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -295,21 +295,17 @@ sg_open

[PATCH v5 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-21 Thread Vaughan Cao
ict in cherrry-pick. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 61 ++- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index f0e4785..3431d12 100644 --- a/drivers/scsi/sg.c +++ b/drivers/s

[PATCH v5 2/4] [SCSI] sg: no need sg_open_exclusive_lock

2013-07-21 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git

[PATCH v5 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-21 Thread Vaughan Cao
ict in cherrry-pick. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 61 ++- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index f0e4785..3431d12 100644 --- a/drivers/scsi/sg.c +++ b/drivers/s

[PATCH v5 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-21 Thread Vaughan Cao
in sg_add_sfp Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 671b760..f0e4785 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -295,21 +295,17 @@ sg_open

[PATCH v5 3/4] [SCSI] sg: checking sdp-detached isn't protected when open

2013-07-21 Thread Vaughan Cao
in sg_add_sfp Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 671b760..f0e4785 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -295,21

[PATCH v5 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-21 Thread Vaughan Cao
-pick. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 61 ++- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index f0e4785..3431d12 100644 --- a/drivers/scsi/sg.c

[PATCH v5 2/4] [SCSI] sg: no need sg_open_exclusive_lock

2013-07-21 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29

[PATCH v5 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-21 Thread Vaughan Cao
-pick. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 61 ++- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index f0e4785..3431d12 100644 --- a/drivers/scsi/sg.c

[PATCH v5 1/4] [SCSI] sg: use rwsem to solve race during exclusive open

2013-07-21 Thread Vaughan Cao
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@oracle.com --- drivers/scsi/sg.c | 77

[PATCH v5 3/4] [SCSI] sg: checking sdp-detached isn't protected when open

2013-07-21 Thread Vaughan Cao
in sg_add_sfp Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 671b760..f0e4785 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -295,21

[PATCH v5 0/4] [SCSI] sg: fix race condition in sg_open

2013-07-21 Thread Vaughan Cao
(), not in sg_remove_sfp(). * not set exclude with sfd_lock held. Vaughan Cao (4): [SCSI] sg: use rwsem to solve race during exclusive open [SCSI] sg: no need sg_open_exclusive_lock [SCSI] sg: checking sdp-detached isn't protected when open [SCSI] sg: push file descriptor list locking down

[PATCH v4 1/4] [SCSI] sg: use rwsem to solve race during exclusive open

2013-07-17 Thread Vaughan Cao
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 --- drivers/scsi/sg.c | 77

[PATCH v4 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-17 Thread Vaughan Cao
@detached is set under the protection of sg_index_lock. Without getting the lock, new sfp will be added during sg removal and there is no chance for it to be picked out. So check with sg_index_lock held in sg_add_sfp(). Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 26

[PATCH v4 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-17 Thread Vaughan Cao
Push file descriptor list locking down to per-device locking. Let sg_index_lock only protect device lookup. sdp->detached is also set and checked with this lock held. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 61 ++- 1 file chan

[PATCH v4 2/4] [SCSI] sg: no need sg_open_exclusive_lock

2013-07-17 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git

[PATCH v4 0/4] [SCSI] sg: fix race condition in sg_open

2013-07-17 Thread Vaughan Cao
There is a race when open sg with O_EXCL flag. Also a race may happen between sg_open and sg_remove. Changes from v3: * release o_sem in sg_release(), not in sg_remove_sfp(). * not set exclude with sfd_lock held. Vaughan Cao (4): [SCSI] sg: use rwsem to solve race during exclusive open

[PATCH v4 0/4] [SCSI] sg: fix race condition in sg_open

2013-07-17 Thread Vaughan Cao
There is a race when open sg with O_EXCL flag. Also a race may happen between sg_open and sg_remove. Changes from v3: * release o_sem in sg_release(), not in sg_remove_sfp(). * not set exclude with sfd_lock held. Vaughan Cao (4): [SCSI] sg: use rwsem to solve race during exclusive open

[PATCH v4 2/4] [SCSI] sg: no need sg_open_exclusive_lock

2013-07-17 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29

[PATCH v4 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-17 Thread Vaughan Cao
Push file descriptor list locking down to per-device locking. Let sg_index_lock only protect device lookup. sdp-detached is also set and checked with this lock held. Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 61

[PATCH v4 1/4] [SCSI] sg: use rwsem to solve race during exclusive open

2013-07-17 Thread Vaughan Cao
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@oracle.com --- drivers/scsi/sg.c | 77

[PATCH v4 3/4] [SCSI] sg: checking sdp-detached isn't protected when open

2013-07-17 Thread Vaughan Cao
@detached is set under the protection of sg_index_lock. Without getting the lock, new sfp will be added during sg removal and there is no chance for it to be picked out. So check with sg_index_lock held in sg_add_sfp(). Signed-off-by: Vaughan Cao vaughan@oracle.com --- drivers/scsi/sg.c | 26