Skip to contentSkip to conversation

is_power_of_2-nfs/internal.h

PATCH In review vignesh babu 5 participants 8 messages Jun 14, 2007 – Jun 20, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 is_power_of_2-nfs/internal.h

Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2

---

fs/nfs/internal.h +2 -1
index ad2b40d..5dca432 100644
@@ -3,6 +3,7 @@
  */
 
 #include <linux/mount.h>
+#include <linux/log2.h>
 
 struct nfs_string;
 struct nfs_mount_data;
@@ -167,7 +168,7 @@ static inline
 unsigned long nfs_block_bits(unsigned long bsize, unsigned char *nrbitsp)
 {
 	/* make sure blocksize is a power of two */
-	if ((bsize & (bsize - 1)) || nrbitsp) {
+	if (is_power_of_2(bsize) || nrbitsp) {
 		unsigned char	nrbits;
 
 		for (nrbits = 31; nrbits && !(bsize & (1 << nrbits)); nrbits--)
Signature · 13 lines
Vignesh Babu BM 
_____________________________________________________________ 
"Why is it that every time I'm with you, makes me believe in magic?"


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
#1 lore raw
Quoted 19 lines · vignesh babu

Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2

---

fs/nfs/internal.h +1 -0
index ad2b40d..5dca432 100644
@@ -3,6 +3,7 @@
  */
 
 #include <linux/mount.h>
+#include <linux/log2.h>
 
 struct nfs_string;
 struct nfs_mount_data;

fs/nfs/internal.h static inline · line 174

Quoted 8 lines
fs/nfs/internal.h +1 -1
@@ -167,7 +168,7 @@ static inline
 unsigned long nfs_block_bits(unsigned long bsize, unsigned char *nrbitsp)
 {
 	/* make sure blocksize is a power of two */
-	if ((bsize & (bsize - 1)) || nrbitsp) {
+	if (is_power_of_2(bsize) || nrbitsp) {
 		unsigned char	nrbits;
 
 		for (nrbits = 31; nrbits && !(bsize & (1 << nrbits)); nrbits--)

We don't need the extra test for bsize = 0 that this introduces: bsize is guaranteed to be at least 1024 or greater.

Trond

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

#2 lore raw

NFS and Samba Winbindd

Hi,

i have the following problem, which i'm not able to solve.

The setup is as follows:

Linux 2.6 Kernel (SLES9-32bit, Post SP3)
nssswitch.conf
[...]
groups: files ldap windbindd
[...]

A user in a an global samba/ldap group. This group is in a local winbindgroup TESTGROUP. (This is right concept used and works for samba shares and interactive logons directly to the server)

There is a directory /test with the only acl TESTGROUP:rwx

This works:
su - $user
cd /work
mkdir test

So all right's a resolved correctly

This works not
exportfs *:/work -o all_squash,anonuid=12345,anongid=12345

uid of $user is 12345

mount /work on some host on /mnt
cd /mnt on the nfs client results in Permission denied

setting an acl:
setfacl -m u:$User:rwx

results in cd /mnt and ls is working.

my question is now:
is the nfsd unable to resolv winbindd local groups?

Mit freundlichem Gruss,

Dirk Laurenz
Systems Engineer
S DE SE PS N/O
Fujitsu Siemens Computers
Hildesheimer Strasse 25
30880 Laatzen
Germany

Telephone:              +49 511 84 89 18 08
Telefax:                +49 511 84 89 25 18 08
Mobile:         +49 170 22 10 781
Email:          mailto: [email protected]
Internet:               http://www.fujitsu-siemens.com
Firmenangaben:          http://www.fujitsu-siemens.de/imprint.html

BEGIN:VCARD
VERSION:2.1
N:Laurenz;Dirk
FN:Laurenz, Dirk
ORG:FSC;FSC S DE SE PS Nord/Ost
TEL;WORK;VOICE:+49 (511) 8489-1808
TEL;CELL;VOICE:+49 (170) 2210-781
ADR;WORK:;/;Hildesheimer Stra�e 25;Hannover / Laatzen;;30880;Germany LABEL;WORK;ENCODING=QUOTED-PRINTABLE:/=0D=0AHildesheimer Stra=DFe 25=0D=0AHannover / Laatzen 30880=0D=0AGermany EMAIL;PREF;INTERNET:[email protected]
REV:20060825T165428Z
END:VCARD

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#3 lore raw

Re: NFS and Samba Winbindd

Hi

Shouldn't it read winbind instead of winbindd in nsswitch.conf?

Regards,
Chris

Quoted 50 lines · Dirk

Hi,

i have the following problem, which i'm not able to solve.

The setup is as follows:

Linux 2.6 Kernel (SLES9-32bit, Post SP3)
nssswitch.conf
[...]
groups: files ldap windbindd
[...]

A user in a an global samba/ldap group. This group is in a local winbindgroup TESTGROUP. (This is right concept used and works for samba shares and interactive logons directly to the server)

There is a directory /test with the only acl TESTGROUP:rwx

This works:
su - $user
cd /work
mkdir test

So all right's a resolved correctly

This works not
exportfs *:/work -o all_squash,anonuid=12345,anongid=12345

uid of $user is 12345

mount /work on some host on /mnt
cd /mnt on the nfs client results in Permission denied

setting an acl:
setfacl -m u:$User:rwx

results in cd /mnt and ls is working.

my question is now:
is the nfsd unable to resolv winbindd local groups?

Mit freundlichem Gruss,

Dirk Laurenz
Systems Engineer
S DE SE PS N/O
Fujitsu Siemens Computers
Hildesheimer Strasse 25
30880 Laatzen
Germany

Quoted 11 lines
Telephone:              +49 511 84 89 18 08
Telefax:                +49 511 84 89 25 18 08
Mobile:         +49 170 22 10 781
Email:          mailto: [email protected]
Internet:               http://www.fujitsu-siemens.com
Firmenangaben:          http://www.fujitsu-siemens.de/imprint.html

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#4 lore raw

Re: NFS and Samba Winbindd

Hi,

sorry, i mistyped this in the email on the server it is correctly typed

Quoted 83 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Osicki
Sent: Friday, June 15, 2007 11:44 AM
To: [email protected]
Subject: Re: [NFS] NFS and Samba Winbindd

Hi

Shouldn't it read winbind instead of winbindd in nsswitch.conf?

Regards,
Chris

Quoted 6 lines · Dirk

Hi,

i have the following problem, which i'm not able to solve.

The setup is as follows:

Quoted 7 lines

Linux 2.6 Kernel (SLES9-32bit, Post SP3)
nssswitch.conf
[...]
groups: files ldap windbindd
[...]

A user in a an global samba/ldap group. This group is in a

local winbindgroup TESTGROUP.

Quoted 1 line

(This is right concept used and works for samba shares and

interactive logons directly to the server)

Quoted 36 lines

There is a directory /test with the only acl TESTGROUP:rwx

This works:
su - $user
cd /work
mkdir test

So all right's a resolved correctly

This works not
exportfs *:/work -o all_squash,anonuid=12345,anongid=12345

uid of $user is 12345

mount /work on some host on /mnt
cd /mnt on the nfs client results in Permission denied

setting an acl:
setfacl -m u:$User:rwx

results in cd /mnt and ls is working.

my question is now:
is the nfsd unable to resolv winbindd local groups?

Mit freundlichem Gruss,

Dirk Laurenz
Systems Engineer
S DE SE PS N/O
Fujitsu Siemens Computers
Hildesheimer Strasse 25
30880 Laatzen
Germany

Quoted 11 lines
Telephone:              +49 511 84 89 18 08
Telefax:                +49 511 84 89 25 18 08
Mobile:         +49 170 22 10 781
Email:          mailto: [email protected]
Internet:               http://www.fujitsu-siemens.com
Firmenangaben:          http://www.fujitsu-siemens.de/imprint.html
Quoted 10 lines

--------------------------------------------------------------
-----------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#5 lore raw

Re: NFS and Samba Winbindd

Hello List,

the problem still persists. Does anyone have an idea? Can i increase the debug level a little bit to see, what the nfsd is doing to resolv memberships?

Quoted 106 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Laurenz, Dirk
Sent: Friday, June 15, 2007 11:58 AM
To: Chris Osicki; [email protected]
Subject: Re: [NFS] NFS and Samba Winbindd

Hi,

sorry, i mistyped this in the email on the server it is correctly typed

Quoted 83 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Osicki
Sent: Friday, June 15, 2007 11:44 AM
To: [email protected]
Subject: Re: [NFS] NFS and Samba Winbindd

Hi

Shouldn't it read winbind instead of winbindd in nsswitch.conf?

Regards,
Chris

Quoted 6 lines · Dirk

Hi,

i have the following problem, which i'm not able to solve.

The setup is as follows:

Quoted 7 lines

Linux 2.6 Kernel (SLES9-32bit, Post SP3)
nssswitch.conf
[...]
groups: files ldap windbindd
[...]

A user in a an global samba/ldap group. This group is in a

local winbindgroup TESTGROUP.

Quoted 1 line

(This is right concept used and works for samba shares and

interactive logons directly to the server)

Quoted 36 lines

There is a directory /test with the only acl TESTGROUP:rwx

This works:
su - $user
cd /work
mkdir test

So all right's a resolved correctly

This works not
exportfs *:/work -o all_squash,anonuid=12345,anongid=12345

uid of $user is 12345

mount /work on some host on /mnt
cd /mnt on the nfs client results in Permission denied

setting an acl:
setfacl -m u:$User:rwx

results in cd /mnt and ls is working.

my question is now:
is the nfsd unable to resolv winbindd local groups?

Mit freundlichem Gruss,

Dirk Laurenz
Systems Engineer
S DE SE PS N/O
Fujitsu Siemens Computers
Hildesheimer Strasse 25
30880 Laatzen
Germany

Quoted 11 lines
Telephone:              +49 511 84 89 18 08
Telefax:                +49 511 84 89 25 18 08
Mobile:         +49 170 22 10 781
Email:          mailto: [email protected]
Internet:               http://www.fujitsu-siemens.com
Firmenangaben:          http://www.fujitsu-siemens.de/imprint.html
Quoted 10 lines

--------------------------------------------------------------
-----------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

Quoted 10 lines

--------------------------------------------------------------
-----------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#6 lore raw

Re: NFS and Samba Winbindd

Quoted 5 lines · Dirk

Hello List,

the problem still persists. Does anyone have an idea? Can i increase the debug level a little bit to see, what the nfsd is doing to resolv memberships?

Do you have /lib/libnss_winbind.so installed, have you set up smb.conf correctly, logged into the domain and started winbind? (see the full description in "man winbind").

If it is all set up correctly, then you should be able to type

getent group TESTGROUP

on the command line, and see the group TESTGROUP being resolved to the correct Windoze group entry.

Trond

Quoted 117 lines
Quoted 106 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Laurenz, Dirk
Sent: Friday, June 15, 2007 11:58 AM
To: Chris Osicki; [email protected]
Subject: Re: [NFS] NFS and Samba Winbindd

Hi,

sorry, i mistyped this in the email on the server it is correctly typed

Quoted 83 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Osicki
Sent: Friday, June 15, 2007 11:44 AM
To: [email protected]
Subject: Re: [NFS] NFS and Samba Winbindd

Hi

Shouldn't it read winbind instead of winbindd in nsswitch.conf?

Regards,
Chris

Quoted 6 lines · Dirk

Hi,

i have the following problem, which i'm not able to solve.

The setup is as follows:

Quoted 7 lines

Linux 2.6 Kernel (SLES9-32bit, Post SP3)
nssswitch.conf
[...]
groups: files ldap windbindd
[...]

A user in a an global samba/ldap group. This group is in a

local winbindgroup TESTGROUP.

Quoted 1 line

(This is right concept used and works for samba shares and

interactive logons directly to the server)

Quoted 36 lines

There is a directory /test with the only acl TESTGROUP:rwx

This works:
su - $user
cd /work
mkdir test

So all right's a resolved correctly

This works not
exportfs *:/work -o all_squash,anonuid=12345,anongid=12345

uid of $user is 12345

mount /work on some host on /mnt
cd /mnt on the nfs client results in Permission denied

setting an acl:
setfacl -m u:$User:rwx

results in cd /mnt and ls is working.

my question is now:
is the nfsd unable to resolv winbindd local groups?

Mit freundlichem Gruss,

Dirk Laurenz
Systems Engineer
S DE SE PS N/O
Fujitsu Siemens Computers
Hildesheimer Strasse 25
30880 Laatzen
Germany

Quoted 11 lines
Telephone:              +49 511 84 89 18 08
Telefax:                +49 511 84 89 25 18 08
Mobile:         +49 170 22 10 781
Email:          mailto: [email protected]
Internet:               http://www.fujitsu-siemens.com
Firmenangaben:          http://www.fujitsu-siemens.de/imprint.html
Quoted 10 lines

--------------------------------------------------------------
-----------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

Quoted 10 lines

--------------------------------------------------------------
-----------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

Quoted 8 lines

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#7 lore raw
In reply to vignesh babu
Quoted 18 lines · vignesh babu

Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2

---

fs/nfs/internal.h +1 -0
index ad2b40d..5dca432 100644
@@ -3,6 +3,7 @@
  */
 
 #include <linux/mount.h>
+#include <linux/log2.h>
 
 struct nfs_string;
 struct nfs_mount_data;

fs/nfs/internal.h static inline · line 171

Quoted 5 lines
fs/nfs/internal.h +1 -1
@@ -167,7 +168,7 @@ static inline
 unsigned long nfs_block_bits(unsigned long bsize, unsigned char *nrbitsp)
 {
 	/* make sure blocksize is a power of two */
-	if ((bsize & (bsize - 1)) || nrbitsp) {
+	if (is_power_of_2(bsize) || nrbitsp) {

Did I miss something but why in this case it's not

+ if (!is_power_of_2(bsize) || nrbitsp) {

?

Quoted 13 lines
fs/nfs/internal.h +0 -0
 		unsigned char	nrbits;
 
 		for (nrbits = 31; nrbits && !(bsize & (1 << nrbits)); nrbits--)
Signature · 9 lines
-- 
Vignesh Babu BM 
_____________________________________________________________ 
"Why is it that every time I'm with you, makes me believe in magic?"

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors