2013-08-05 14:47:47

by Julia Lawall

[permalink] [raw]
Subject: [PATCH] fs/nfs/inode.c: adjust code alignment

From: Julia Lawall <[email protected]>

Signed-off-by: Julia Lawall <[email protected]>

---

This patch adjusts the code so that the alignment matches the current
semantics. I have no idea if it is the intended semantics, though. Should
the call to nfs_setsecurity also be under the else?

fs/nfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index af6e806..d8ad685 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -463,7 +463,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
unlock_new_inode(inode);
} else
nfs_refresh_inode(inode, fattr);
- nfs_setsecurity(inode, fattr, label);
+ nfs_setsecurity(inode, fattr, label);
dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n",
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),



2013-08-05 14:59:57

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH] fs/nfs/inode.c: adjust code alignment

T24gTW9uLCAyMDEzLTA4LTA1IGF0IDE2OjQ3ICswMjAwLCBKdWxpYSBMYXdhbGwgd3JvdGU6DQo+
IEZyb206IEp1bGlhIExhd2FsbCA8SnVsaWEuTGF3YWxsQGxpcDYuZnI+DQo+IA0KPiBTaWduZWQt
b2ZmLWJ5OiBKdWxpYSBMYXdhbGwgPEp1bGlhLkxhd2FsbEBsaXA2LmZyPg0KPiANCj4gLS0tDQo+
IA0KPiBUaGlzIHBhdGNoIGFkanVzdHMgdGhlIGNvZGUgc28gdGhhdCB0aGUgYWxpZ25tZW50IG1h
dGNoZXMgdGhlIGN1cnJlbnQNCj4gc2VtYW50aWNzLiAgSSBoYXZlIG5vIGlkZWEgaWYgaXQgaXMg
dGhlIGludGVuZGVkIHNlbWFudGljcywgdGhvdWdoLiAgU2hvdWxkDQo+IHRoZSBjYWxsIHRvIG5m
c19zZX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g
J3RoZW4nIGNsYXVzZSBvZiB0aGUgaWYNCnN0YXRlbWVudCBhbHJlYWR5IGNhbGxzIG5mc19zZXRz
ZWN1cml0eSBiZWZvcmUgdW5sb2NraW5nIHRoZSBpbm9kZSwgSQ0Kc3VzcGVjdCB0aGF0IHRoZSBh
Ym92ZSBfc2hvdWxkXyByZWFsbHkgYmUgcGFydCBvZiB0aGUgJ2Vsc2UnIGNsYXVzZS4gDQoNClRo
YXQgc2FpZCwgSSBjYW4ndCBzZWUgdGhhdCBjYWxsaW5nIG5mc19zZXRzZWN1cml0eSB0d2ljZSBv
biB0aGUgaW5vZGUNCmNhbiBjYXVzZSBhbnkgdW5pbnRlbmRlZCBzaWRlLWVmZmVjdHMsIHNvIEkg
c3VnZ2VzdCB0aGF0IHdlIHJhdGhlciBxdWV1ZQ0KdGhlIHBhdGNoIHVwIGZvciBpbmNsdXNpb24g
aW4gMy4xMi4NClN0ZXZlIGFuZCBEYXZlLCBhbnkgY29tbWVudHM/DQoNCi0tIA0KVHJvbmQgTXlr
bGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWts
ZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg==

2013-08-06 18:04:22

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] fs/nfs/inode.c: adjust code alignment

Hello,

On 05/08/13 10:59, Myklebust, Trond wrote:
> On Mon, 2013-08-05 at 16:47 +0200, Julia Lawall wrote:
>> From: Julia Lawall <[email protected]>
>>
>> Signed-off-by: Julia Lawall <[email protected]>
>>
>> ---
>>
>> This patch adjusts the code so that the alignment matches the current
>> semantics. I have no idea if it is the intended semantics, though. Should
>> the call to nfs_setsecurity also be under the else?
>>
>
>> fs/nfs/inode.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
>> index af6e806..d8ad685 100644
>> --- a/fs/nfs/inode.c
>> +++ b/fs/nfs/inode.c
>> @@ -463,7 +463,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh
>> *fh, struct nfs_fattr *fattr, st
>> unlock_new_inode(inode);
>> } else
>> nfs_refresh_inode(inode, fattr);
>> - nfs_setsecurity(inode, fattr, label);
>> + nfs_setsecurity(inode, fattr, label);
This call to nfs_setsecurity() is not needed. The security only needs
to be set when the i-node is created...

steved.

>> dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n",
>> inode->i_sb->s_id,
>> (long long)NFS_FILEID(inode),
>
> Hi Julia,
>
> Thanks for pointing this out! Given that the 'then' clause of the if
> statement already calls nfs_setsecurity before unlocking the inode, I
> suspect that the above _should_ really be part of the 'else' clause.
>
> That said, I can't see that calling nfs_setsecurity twice on the inode
> can cause any unintended side-effects, so I suggest that we rather queue
> the patch up for inclusion in 3.12.
> Steve and Dave, any comments?
>

2013-08-07 02:05:00

by Dave Quigley

[permalink] [raw]
Subject: Re: [PATCH] fs/nfs/inode.c: adjust code alignment

On 8/6/2013 2:04 PM, Steve Dickson wrote:
> Hello,
>
> On 05/08/13 10:59, Myklebust, Trond wrote:
>> On Mon, 2013-08-05 at 16:47 +0200, Julia Lawall wrote:
>>> From: Julia Lawall <[email protected]>
>>>
>>> Signed-off-by: Julia Lawall <[email protected]>
>>>
>>> ---
>>>
>>> This patch adjusts the code so that the alignment matches the current
>>> semantics. I have no idea if it is the intended semantics, though. Should
>>> the call to nfs_setsecurity also be under the else?
>>>
>>
>>> fs/nfs/inode.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
>>> index af6e806..d8ad685 100644
>>> --- a/fs/nfs/inode.c
>>> +++ b/fs/nfs/inode.c
>>> @@ -463,7 +463,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh
>>> *fh, struct nfs_fattr *fattr, st
>>> unlock_new_inode(inode);
>>> } else
>>> nfs_refresh_inode(inode, fattr);
>>> - nfs_setsecurity(inode, fattr, label);
>>> + nfs_setsecurity(inode, fattr, label);
> This call to nfs_setsecurity() is not needed. The security only needs
> to be set when the i-node is created...
>
> steved.
>
>>> dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n",
>>> inode->i_sb->s_id,
>>> (long long)NFS_FILEID(inode),
>>
>> Hi Julia,
>>
>> Thanks for pointing this out! Given that the 'then' clause of the if
>> statement already calls nfs_setsecurity before unlocking the inode, I
>> suspect that the above _should_ really be part of the 'else' clause.
>>
>> That said, I can't see that calling nfs_setsecurity twice on the inode
>> can cause any unintended side-effects, so I suggest that we rather queue
>> the patch up for inclusion in 3.12.
>> Steve and Dave, any comments?
>>
>

I can't see why it would be needed either. I agree with Steve. We can
get rid of it.

Dave