* Inode numbers on 32 Bit Linux
@ 2011-10-20 6:28 Amon Ott
2011-10-20 20:01 ` Sage Weil
0 siblings, 1 reply; 2+ messages in thread
From: Amon Ott @ 2011-10-20 6:28 UTC (permalink / raw)
To: ceph-devel
Hi all,
we need to run 32 Bit Linux kernels, but file identification of our RSBAC
access control system relies on unique inode numbers. Plain Ceph uses inode
number 1 for all filesystem objects, leading to id problems. To check
yourself, make a "find" and see that it complains about file system loops
because of this. ls -i shows number 1 for all items.
I changed the inode number generation as follows to get unique numbers and now
everything works fine without collisions.
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 35dc965..bb73b49 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -344,9 +344,10 @@ static inline struct ceph_vino ceph_vino(struct inode
*inode)
* x86_64+ino32 64 32
* x86_64 64 64
*/
-static inline u32 ceph_ino_to_ino32(ino_t ino)
+static inline u32 ceph_ino_to_ino32(__u64 vino)
{
- ino ^= ino >> (sizeof(ino) * 8 - 32);
+ u32 ino = vino & 0xffffffff;
+ ino ^= vino >> 32;
if (!ino)
ino = 1;
return ino;
@@ -359,9 +360,10 @@ static inline ino_t ceph_vino_to_ino(struct ceph_vino
vino)
{
ino_t ino = (ino_t)vino.ino; /* ^ (vino.snap << 20); */
#if BITS_PER_LONG == 32
- ino = ceph_ino_to_ino32(ino);
+ return ceph_ino_to_ino32(vino.ino);
+#else
+ return (ino_t)vino.ino;
#endif
- return ino;
}
Amon Ott
--
Dr. Amon Ott
m-privacy GmbH Tel: +49 30 24342334
Am Köllnischen Park 1 Fax: +49 30 24342336
10179 Berlin http://www.m-privacy.de
Amtsgericht Charlottenburg, HRB 84946
Geschäftsführer:
Dipl.-Kfm. Holger Maczkowsky,
Roman Maczkowsky
GnuPG-Key-ID: 0x2DD3A649
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Inode numbers on 32 Bit Linux
2011-10-20 6:28 Inode numbers on 32 Bit Linux Amon Ott
@ 2011-10-20 20:01 ` Sage Weil
0 siblings, 0 replies; 2+ messages in thread
From: Sage Weil @ 2011-10-20 20:01 UTC (permalink / raw)
To: Amon Ott; +Cc: ceph-devel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2158 bytes --]
Queueing this for 3.2-rc1, thanks!
sage
On Thu, 20 Oct 2011, Amon Ott wrote:
> Hi all,
>
> we need to run 32 Bit Linux kernels, but file identification of our RSBAC
> access control system relies on unique inode numbers. Plain Ceph uses inode
> number 1 for all filesystem objects, leading to id problems. To check
> yourself, make a "find" and see that it complains about file system loops
> because of this. ls -i shows number 1 for all items.
>
> I changed the inode number generation as follows to get unique numbers and now
> everything works fine without collisions.
>
> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> index 35dc965..bb73b49 100644
> --- a/fs/ceph/super.h
> +++ b/fs/ceph/super.h
> @@ -344,9 +344,10 @@ static inline struct ceph_vino ceph_vino(struct inode
> *inode)
> * x86_64+ino32 64 32
> * x86_64 64 64
> */
> -static inline u32 ceph_ino_to_ino32(ino_t ino)
> +static inline u32 ceph_ino_to_ino32(__u64 vino)
> {
> - ino ^= ino >> (sizeof(ino) * 8 - 32);
> + u32 ino = vino & 0xffffffff;
> + ino ^= vino >> 32;
> if (!ino)
> ino = 1;
> return ino;
> @@ -359,9 +360,10 @@ static inline ino_t ceph_vino_to_ino(struct ceph_vino
> vino)
> {
> ino_t ino = (ino_t)vino.ino; /* ^ (vino.snap << 20); */
> #if BITS_PER_LONG == 32
> - ino = ceph_ino_to_ino32(ino);
> + return ceph_ino_to_ino32(vino.ino);
> +#else
> + return (ino_t)vino.ino;
> #endif
> - return ino;
> }
>
>
>
> Amon Ott
> --
> Dr. Amon Ott
> m-privacy GmbH Tel: +49 30 24342334
> Am Köllnischen Park 1 Fax: +49 30 24342336
> 10179 Berlin http://www.m-privacy.de
>
> Amtsgericht Charlottenburg, HRB 84946
>
> Geschäftsführer:
> Dipl.-Kfm. Holger Maczkowsky,
> Roman Maczkowsky
>
> GnuPG-Key-ID: 0x2DD3A649
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-20 20:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-20 6:28 Inode numbers on 32 Bit Linux Amon Ott
2011-10-20 20:01 ` Sage Weil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.