All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amon Ott <a.ott@m-privacy.de>
To: ceph-devel@vger.kernel.org
Subject: Inode numbers on 32 Bit Linux
Date: Thu, 20 Oct 2011 08:28:26 +0200	[thread overview]
Message-ID: <201110200828.26887.a.ott@m-privacy.de> (raw)

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

             reply	other threads:[~2011-10-20  6:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20  6:28 Amon Ott [this message]
2011-10-20 20:01 ` Inode numbers on 32 Bit Linux Sage Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110200828.26887.a.ott@m-privacy.de \
    --to=a.ott@m-privacy.de \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.