Re: [PATCH-v2 2/9] target/pr: Use atomic bitop for se_dev_entry->pr_reg reservation check

Christoph Hellwig
2015-05-22T08:26:14Z

On Fri, May 22, 2015 at 06:11:04AM +0000, Nicholas A. Bellinger wrote:
> + clear_bit(1, &orig->pr_reg);

Can you call it ->flags and give the bit a meaningful name?

> diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
> index c0b593a..d29b39c 100644
> --- a/drivers/target/target_core_pr.c
> +++ b/drivers/target/target_core_pr.c
> @@ -327,9 +327,13 @@ static int core_scsi3_pr_seq_non_holder(
> int we = 0; /* Write Exclusive */
> int legacy = 0; /* Act like a legacy device and return
> * RESERVATION CONFLICT on some CDBs */
> + bool registered = false;
>
> rcu_read_lock();
> se_deve = target_nacl_find_deve(nacl, cmd->orig_fe_lun);
> + if (se_deve)
> + registered = test_bit(1, &se_deve->pr_reg);
> + rcu_read_unlock();

It would be good to just sort out the registered and co variables
here before the RCU changes, as in: