All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: ceph-devel@vger.kernel.org
Subject: [RFC PATCH] client: don't use special inode for /..
Date: Wed, 10 Aug 2016 12:30:30 -0400	[thread overview]
Message-ID: <1470846630-830-1-git-send-email-jlayton@redhat.com> (raw)

The CEPH_INO_DOTDOT thing is quite strange. Under most OS (Linux
included), the parent of the root is itself. IOW, at the root, '.' and
'..' refer to the same inode.

Change the ceph client to do the same, as this allows users to get
valid stat info for '..', as well as elimnating some special-casing.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 src/client/Client.cc  | 13 +++----------
 src/include/ceph_fs.h |  1 -
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/client/Client.cc b/src/client/Client.cc
index 2df632fc0e08..77f464ad76ae 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -7244,9 +7244,9 @@ int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p)
       fill_stat(in, &st);
       fill_dirent(&de, "..", S_IFDIR, st.st_ino, next_off);
     } else {
-      /* must be at the root (no parent),
-       * so we add the dotdot with a special inode (3) */
-      fill_dirent(&de, "..", S_IFDIR, CEPH_INO_DOTDOT, next_off);
+      /* must be at the root (no parent), so fill out with same info as "." */
+      fill_stat(diri, &st);
+      fill_dirent(&de, "..", S_IFDIR, st.st_ino, next_off);
     }
 
 
@@ -9684,13 +9684,6 @@ int Client::ll_getattr(Inode *in, struct stat *attr, int uid, int gid)
   tout(cct) << "ll_getattr" << std::endl;
   tout(cct) << vino.ino.val << std::endl;
 
-  /* special case for dotdot (..) */
-  if (vino.ino.val == CEPH_INO_DOTDOT) {
-    attr->st_mode = S_IFDIR | 0755;
-    attr->st_nlink = 2;
-    return 0;
-  }
-
   int res;
   if (vino.snapid < CEPH_NOSNAP)
     res = 0;
diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h
index 772e475ccc91..1610aaf17cc2 100644
--- a/src/include/ceph_fs.h
+++ b/src/include/ceph_fs.h
@@ -28,7 +28,6 @@
 
 #define CEPH_INO_ROOT   1
 #define CEPH_INO_CEPH   2       /* hidden .ceph dir */
-#define CEPH_INO_DOTDOT 3	/* used by ceph fuse for parent (..) */
 #define CEPH_INO_LOST_AND_FOUND 4	/* reserved ino for use in recovery */
 
 /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
-- 
2.7.4


             reply	other threads:[~2016-08-10 18:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 16:30 Jeff Layton [this message]
2016-08-10 20:08 ` [RFC PATCH] client: don't use special inode for / Patrick Donnelly
2016-08-10 20:30   ` Jeff Layton
2016-08-10 20:46     ` Patrick Donnelly
2016-08-10 21:06       ` Jeff Layton
2016-08-10 21:15         ` Patrick Donnelly
2016-08-10 22:21           ` Jeff Layton
2016-08-11  1:31             ` Jeff Layton
2016-08-10 21:23     ` Sage Weil
2016-08-10 21:52       ` Jeff Layton

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=1470846630-830-1-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --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.