Skip to contentSkip to conversation

ceph: make the lost+found dir accessible by kernel client

PATCH In review [email protected] 2 participants 6 messages Apr 19, 2021 – Apr 20, 2021

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

PATCH 1/1 ceph: make the lost+found dir accessible by kernel client

From: Xiubo Li <[email protected]>

Inode number 0x4 is reserved for the lost+found dir, and the app or test app need to access it.

URL: https://tracker.ceph.com/issues/50216

---
 fs/ceph/super.h              | 3 ++-
 include/linux/ceph/ceph_fs.h | 7 ++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
fs/ceph/super.h +2 -1
index 4808a1458c9b..0f38e6183ff0 100644
@@ -542,7 +542,8 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
 
 static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
 {
-	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT) {
+	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT &&
+	    vino.ino != CEPH_INO_LOST_AND_FOUND ) {
 		WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino);
 		return true;
 	}
include/linux/ceph/ceph_fs.h +4 -3
index e41a811026f6..57e5bd63fb7a 100644
@@ -27,9 +27,10 @@
 #define CEPH_MONC_PROTOCOL   15 /* server/client */
 
 
-#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_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 /* lost+found dir */
 
 /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
 #define CEPH_MAX_MON   31
Signature · 1 line
2.27.0
#1 lore raw
Quoted 54 lines · On Mon, 2021-04-19 at 10:32 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Inode number 0x4 is reserved for the lost+found dir, and the app or test app need to access it.

URL: https://tracker.ceph.com/issues/50216

---
 fs/ceph/super.h | 3 ++-
 include/linux/ceph/ceph_fs.h | 7 ++++---

 2 files changed, 6 insertions(+), 4 deletions(-)
fs/ceph/super.h +0 -0
index 4808a1458c9b..0f38e6183ff0 100644
@@ -542,7 +542,8 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)

 static inline bool ceph_vino_is_reserved(const struct ceph_vino vino) {

fs/ceph/super.h +2 -1
-	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT) {
+	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT &&
+	    vino.ino != CEPH_INO_LOST_AND_FOUND ) {

  WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino); return true;
  }

include/linux/ceph/ceph_fs.h +0 -0
index e41a811026f6..57e5bd63fb7a 100644
@@ -27,9 +27,10 @@
  #define CEPH_MONC_PROTOCOL   15 /* server/client */

include/linux/ceph/ceph_fs.h +4 -3
-#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_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 /* lost+found dir */

Quoted 2 lines

 /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
 #define CEPH_MAX_MON 31

Thanks Xiubo,

For some background, apparently cephfs-data-scan can create this directory, and the clients do need access to it. I'll fold this into the original patch that makes these inodes inaccessible (ceph: don't allow access to MDS-private inodes).

Cheers!

Signature · 1 line
Jeff Layton <[email protected]>
author
#2 lore raw
Quoted 55 lines · Jeff Layton
Quoted 54 lines · On Mon, 2021-04-19 at 10:32 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Inode number 0x4 is reserved for the lost+found dir, and the app or test app need to access it.

URL: https://tracker.ceph.com/issues/50216

---
  fs/ceph/super.h              | 3 ++-
  include/linux/ceph/ceph_fs.h | 7 ++++---
  2 files changed, 6 insertions(+), 4 deletions(-)
fs/ceph/super.h +2 -1
index 4808a1458c9b..0f38e6183ff0 100644
@@ -542,7 +542,8 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
 
 
 
 
  static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
  {
-	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT) {
+	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT &&
+	    vino.ino != CEPH_INO_LOST_AND_FOUND ) {

  WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino); return true;
  }

include/linux/ceph/ceph_fs.h +4 -3
index e41a811026f6..57e5bd63fb7a 100644
@@ -27,9 +27,10 @@
  #define CEPH_MONC_PROTOCOL   15 /* server/client */
 
 
 
 
 
 
 
 
-#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_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 /* lost+found dir */
Quoted 8 lines
Quoted 2 lines

 /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
 #define CEPH_MAX_MON 31

Thanks Xiubo,

For some background, apparently cephfs-data-scan can create this directory, and the clients do need access to it. I'll fold this into the original patch that makes these inodes inaccessible (ceph: don't allow access to MDS-private inodes).

Yeah, sure.

Thanks.
BRs

Quoted 1 line

Cheers!

author
#3 lore raw
In reply to Jeff Layton
Quoted 44 lines · Jeff Layton
Quoted 43 lines · On Mon, 2021-04-19 at 10:32 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Inode number 0x4 is reserved for the lost+found dir, and the app or test app need to access it.

URL: https://tracker.ceph.com/issues/50216

---
  fs/ceph/super.h              | 3 ++-
  include/linux/ceph/ceph_fs.h | 7 ++++---
  2 files changed, 6 insertions(+), 4 deletions(-)
fs/ceph/super.h +2 -1
index 4808a1458c9b..0f38e6183ff0 100644
@@ -542,7 +542,8 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
 
 
 
 
  static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
  {
-	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT) {
+	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT &&
+	    vino.ino != CEPH_INO_LOST_AND_FOUND ) {

  WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino); return true;
  }

include/linux/ceph/ceph_fs.h +0 -0
index e41a811026f6..57e5bd63fb7a 100644
@@ -27,9 +27,10 @@
  #define CEPH_MONC_PROTOCOL   15 /* server/client */
 
 
 
 
 
 
 
 
Quoted 3 lines

include/linux/ceph/ceph_fs.h line 32

Quoted 3 lines
include/linux/ceph/ceph_fs.h +0 -3
-#define CEPH_INO_ROOT   1
-#define CEPH_INO_CEPH   2       /* hidden .ceph dir */
-#define CEPH_INO_DOTDOT 3	/* used by ceph fuse for parent (..) */

Hi Jeff,

Please fix the "CEPH_INO_DOTDOT" when you folding this patch. The inode number 3 is not _DOTDOT any more. This was introduced by an very old commit(dd6f5e105d85e) but I couldn't find the related change about this in ceph code.

It should be:

#define CEPH_INO_GLOBAL_SNAPREALM 3

Quoted 18 lines

include/linux/ceph/ceph_fs.h line 36

Quoted 10 lines
include/linux/ceph/ceph_fs.h +4 -0
+#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 /* lost+found dir */
 
 
 
 
  /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
  #define CEPH_MAX_MON   31

Thanks Xiubo,

For some background, apparently cephfs-data-scan can create this directory, and the clients do need access to it. I'll fold this into the original patch that makes these inodes inaccessible (ceph: don't allow access to MDS-private inodes).

Cheers!

#4 lore raw
Quoted 51 lines · Xiubo Li
Quoted 44 lines · Jeff Layton
Quoted 43 lines · On Mon, 2021-04-19 at 10:32 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Inode number 0x4 is reserved for the lost+found dir, and the app or test app need to access it.

URL: https://tracker.ceph.com/issues/50216

---
  fs/ceph/super.h              | 3 ++-
  include/linux/ceph/ceph_fs.h | 7 ++++---
  2 files changed, 6 insertions(+), 4 deletions(-)
fs/ceph/super.h +2 -1
index 4808a1458c9b..0f38e6183ff0 100644
@@ -542,7 +542,8 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
 
 
 
 
  static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
  {
-	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT) {
+	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT &&
+	    vino.ino != CEPH_INO_LOST_AND_FOUND ) {

  WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino); return true;
  }

include/linux/ceph/ceph_fs.h +0 -0
index e41a811026f6..57e5bd63fb7a 100644
@@ -27,9 +27,10 @@
  #define CEPH_MONC_PROTOCOL   15 /* server/client */
 
 
 
 
 
 
 
 
Quoted 3 lines

include/linux/ceph/ceph_fs.h line 32

Quoted 3 lines
include/linux/ceph/ceph_fs.h +0 -3
-#define CEPH_INO_ROOT   1
-#define CEPH_INO_CEPH   2       /* hidden .ceph dir */
-#define CEPH_INO_DOTDOT 3	/* used by ceph fuse for parent (..) */

Hi Jeff,

Quoted 10 lines

Please fix the "CEPH_INO_DOTDOT" when you folding this patch. The inode number 3 is not _DOTDOT any more. This was introduced by an very old commit(dd6f5e105d85e) but I couldn't find the related change about this in ceph code.

It should be:

#define CEPH_INO_GLOBAL_SNAPREALM 3

Sounds good. I can fold that change into the patch.

What should we use for a comment there? I took a look at the MDS code and it wasn't clear to me what the global_snaprealm is actually for...

Quoted 20 lines
Quoted 18 lines

include/linux/ceph/ceph_fs.h line 36

Quoted 10 lines
include/linux/ceph/ceph_fs.h +4 -0
+#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 /* lost+found dir */
 
 
 
 
  /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
  #define CEPH_MAX_MON   31

Thanks Xiubo,

For some background, apparently cephfs-data-scan can create this directory, and the clients do need access to it. I'll fold this into the original patch that makes these inodes inaccessible (ceph: don't allow access to MDS-private inodes).

Cheers!

Signature · 1 line
Jeff Layton <[email protected]>
author
#5 lore raw
Quoted 58 lines · Jeff Layton
Quoted 57 lines · Xiubo Li
Quoted 44 lines · Jeff Layton
Quoted 43 lines · On Mon, 2021-04-19 at 10:32 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Inode number 0x4 is reserved for the lost+found dir, and the app or test app need to access it.

URL: https://tracker.ceph.com/issues/50216

---
   fs/ceph/super.h              | 3 ++-
   include/linux/ceph/ceph_fs.h | 7 ++++---
   2 files changed, 6 insertions(+), 4 deletions(-)
fs/ceph/super.h +2 -1
index 4808a1458c9b..0f38e6183ff0 100644
@@ -542,7 +542,8 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
 
 
 
 
   static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
   {
-	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT) {
+	if (vino.ino < CEPH_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT &&
+	    vino.ino != CEPH_INO_LOST_AND_FOUND ) {

  WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino); return true;
  }

include/linux/ceph/ceph_fs.h +0 -0
index e41a811026f6..57e5bd63fb7a 100644
@@ -27,9 +27,10 @@
   #define CEPH_MONC_PROTOCOL   15 /* server/client */
 
 
 
 
 
 
 
 
Quoted 3 lines

include/linux/ceph/ceph_fs.h line 32

Quoted 3 lines
include/linux/ceph/ceph_fs.h +0 -3
-#define CEPH_INO_ROOT   1
-#define CEPH_INO_CEPH   2       /* hidden .ceph dir */
-#define CEPH_INO_DOTDOT 3	/* used by ceph fuse for parent (..) */

Hi Jeff,

Please fix the "CEPH_INO_DOTDOT" when you folding this patch. The inode number 3 is not _DOTDOT any more. This was introduced by an very old commit(dd6f5e105d85e) but I couldn't find the related change about this in ceph code.

It should be:

Quoted 7 lines
Quoted 3 lines

#define CEPH_INO_GLOBAL_SNAPREALM 3

Sounds good. I can fold that change into the patch.

What should we use for a comment there? I took a look at the MDS code and it wasn't clear to me what the global_snaprealm is actually for...

Maybe the commit comment title is a good choice from Zheng's initial commit:

commit 0f31d49de20bd40836dceebb06e12763a1def5e0
Author: Yan, Zheng <[email protected]>
Date:   Thu Oct 26 15:32:29 2017 +0800

    mds: attach inode with multiple hardlinks to dummy global snaprealm

    The dummy global snaprealm includes all snapshots in the filesystem. For any later snapshot, mds will COW the inode and preserve snap data. These snap data will cover any possible snapshot on remote linkages of the inode.

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines

include/linux/ceph/ceph_fs.h line 36

Quoted 10 lines
include/linux/ceph/ceph_fs.h +4 -0
+#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 /* lost+found dir */
 
 
 
 
   /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
   #define CEPH_MAX_MON   31

Thanks Xiubo,

For some background, apparently cephfs-data-scan can create this directory, and the clients do need access to it. I'll fold this into the original patch that makes these inodes inaccessible (ceph: don't allow access to MDS-private inodes).

Cheers!