[HPDD-discuss] [PATCH] staging: lustre: fix sparse warnings related to lock context imbalance

Patrick Farrell paf at cray.com
Fri Nov 28 15:45:24 UTC 2014


Dan,

I disagree about the change suggested here.  In this particular code, 'object_attr' is distinct from 'attr', as in a 'setattr' call on an inode.  'cl_object' is a distinct thing from an inode/file on disk, and specifying it is the objects attr is helpful in understanding there is not a direct relationship to 'attr' in the general filesystem sense.  (cl_object attrs are used in determining actual on disk attributes, but there is not a one-to-one correspondence.)

I am willing to be corrected, but that is my first feeling here.

- Patrick
________________________________________
From: HPDD-discuss [hpdd-discuss-bounces at lists.01.org] on behalf of Dan Carpenter [dan.carpenter at oracle.com]
Sent: Friday, November 28, 2014 4:00 AM
To: Loïc Pefferkorn
Cc: devel at driverdev.osuosl.org; Greg KH; linux-kernel at vger.kernel.org; gdonald at gmail.com; HPDD-discuss at ml01.01.org
Subject: Re: [HPDD-discuss] [PATCH] staging: lustre: fix sparse warnings related to lock context imbalance

On Thu, Nov 27, 2014 at 07:34:10PM +0100, Loïc Pefferkorn wrote:
> 1827         if (valid != 0) {
> 1828             cl_object_attr_lock(obj);
> 1829             cl_object_attr_set(env, obj, attr, valid);
> 1830             cl_object_attr_unlock(obj);
>
> after:
>
> 1827         if (valid != 0) {
> 1828             spin_lock(cl_object_attr_guard(obj));
> 1829             cl_object_attr_set(env, obj, attr, valid);
> 1830             spin_unlock(cl_object_attr_guard(obj));

The word "_object" doesn't add any new information to the name.  If you
remove it then the code is improved.

                spin_lock(cl_attr_guard(obj));
                cl_attr_set(env, obj, attr, valid);
                spin_unlock(cl_attr_guard(obj));


regards,
dan carpenter

_______________________________________________
HPDD-discuss mailing list
HPDD-discuss at lists.01.org
https://lists.01.org/mailman/listinfo/hpdd-discuss


More information about the devel mailing list