> -             if (sg_res_in_use(sfp)) {
> +             mutex_lock(&sfp->f_mutex);
> +             if (sfp->res_in_use) {
> +                     mutex_unlock(&sfp->f_mutex);
>                       sg_remove_request(sfp, srp);
>                       return -EBUSY;  /* reserve buffer already being used */
>               }
> +             mutex_unlock(&sfp->f_mutex);

Holding a mutex over a the check of a single scalar doesn't make sense.

Reply via email to