* [PATCH 0/2] ceph: create the global dummy snaprealm once
@ 2022-02-22 6:34 xiubli
2022-02-22 6:34 ` [PATCH 1/2] ceph: remove incorrect and unused CEPH_INO_DOTDOT macro xiubli
2022-02-22 6:34 ` [PATCH 2/2] ceph: do not release the global snaprealm until unmounting xiubli
0 siblings, 2 replies; 5+ messages in thread
From: xiubli @ 2022-02-22 6:34 UTC (permalink / raw)
To: jlayton; +Cc: idryomov, vshankar, ceph-devel, Xiubo Li
From: Xiubo Li <xiubli@redhat.com>
Xiubo Li (2):
ceph: remove incorrect and unused CEPH_INO_DOTDOT macro
ceph: do not release the global snaprealm until unmounting
fs/ceph/mds_client.c | 2 +-
fs/ceph/snap.c | 13 +++++++++++--
fs/ceph/super.h | 2 +-
include/linux/ceph/ceph_fs.h | 4 ++--
4 files changed, 15 insertions(+), 6 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ceph: remove incorrect and unused CEPH_INO_DOTDOT macro
2022-02-22 6:34 [PATCH 0/2] ceph: create the global dummy snaprealm once xiubli
@ 2022-02-22 6:34 ` xiubli
2022-02-22 6:34 ` [PATCH 2/2] ceph: do not release the global snaprealm until unmounting xiubli
1 sibling, 0 replies; 5+ messages in thread
From: xiubli @ 2022-02-22 6:34 UTC (permalink / raw)
To: jlayton; +Cc: idryomov, vshankar, ceph-devel, Xiubo Li
From: Xiubo Li <xiubli@redhat.com>
Ceph have removed this macro and the 0x3 will be use for global dummy
snaprealm.
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
include/linux/ceph/ceph_fs.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 66db21ac5f0c..f14f9bc290e6 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -29,7 +29,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 (..) */
/* arbitrary limit on max # of monitors (cluster of 3 is typical) */
#define CEPH_MAX_MON 31
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] ceph: do not release the global snaprealm until unmounting
2022-02-22 6:34 [PATCH 0/2] ceph: create the global dummy snaprealm once xiubli
2022-02-22 6:34 ` [PATCH 1/2] ceph: remove incorrect and unused CEPH_INO_DOTDOT macro xiubli
@ 2022-02-22 6:34 ` xiubli
2022-02-22 10:22 ` Jeff Layton
1 sibling, 1 reply; 5+ messages in thread
From: xiubli @ 2022-02-22 6:34 UTC (permalink / raw)
To: jlayton; +Cc: idryomov, vshankar, ceph-devel, Xiubo Li
From: Xiubo Li <xiubli@redhat.com>
The global snaprealm would be created and then destroyed immediately
every time when updating it.
URL: https://tracker.ceph.com/issues/54362
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
fs/ceph/mds_client.c | 2 +-
fs/ceph/snap.c | 13 +++++++++++--
fs/ceph/super.h | 2 +-
include/linux/ceph/ceph_fs.h | 3 ++-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 65bd43d4cafc..325f8071a324 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -4866,7 +4866,7 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc)
mutex_unlock(&mdsc->mutex);
ceph_cleanup_snapid_map(mdsc);
- ceph_cleanup_empty_realms(mdsc);
+ ceph_cleanup_global_and_empty_realms(mdsc);
cancel_work_sync(&mdsc->cap_reclaim_work);
cancel_delayed_work_sync(&mdsc->delayed_work); /* cancel timer */
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 66a1a92cf579..cc9097c27052 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -121,7 +121,11 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
if (!realm)
return ERR_PTR(-ENOMEM);
- atomic_set(&realm->nref, 1); /* for caller */
+ /* Do not release the global dummy snaprealm until unmouting */
+ if (ino == CEPH_INO_GLOBAL_SNAPREALM)
+ atomic_set(&realm->nref, 2);
+ else
+ atomic_set(&realm->nref, 1);
realm->ino = ino;
INIT_LIST_HEAD(&realm->children);
INIT_LIST_HEAD(&realm->child_item);
@@ -261,9 +265,14 @@ static void __cleanup_empty_realms(struct ceph_mds_client *mdsc)
spin_unlock(&mdsc->snap_empty_lock);
}
-void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc)
+void ceph_cleanup_global_and_empty_realms(struct ceph_mds_client *mdsc)
{
+ struct ceph_snap_realm *global_realm;
+
down_write(&mdsc->snap_rwsem);
+ global_realm = __lookup_snap_realm(mdsc, CEPH_INO_GLOBAL_SNAPREALM);
+ if (global_realm)
+ ceph_put_snap_realm(mdsc, global_realm);
__cleanup_empty_realms(mdsc);
up_write(&mdsc->snap_rwsem);
}
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index baac800a6d11..250aefecd628 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -942,7 +942,7 @@ extern void ceph_handle_snap(struct ceph_mds_client *mdsc,
struct ceph_msg *msg);
extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
struct ceph_cap_snap *capsnap);
-extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc);
+extern void ceph_cleanup_global_and_empty_realms(struct ceph_mds_client *mdsc);
extern struct ceph_snapid_map *ceph_get_snapid_map(struct ceph_mds_client *mdsc,
u64 snap);
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index f14f9bc290e6..86bf82dbd8b8 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -28,7 +28,8 @@
#define CEPH_INO_ROOT 1
-#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
+#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
+#define CEPH_INO_GLOBAL_SNAPREALM 3 /* global dummy snaprealm */
/* arbitrary limit on max # of monitors (cluster of 3 is typical) */
#define CEPH_MAX_MON 31
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ceph: do not release the global snaprealm until unmounting
2022-02-22 6:34 ` [PATCH 2/2] ceph: do not release the global snaprealm until unmounting xiubli
@ 2022-02-22 10:22 ` Jeff Layton
2022-02-22 10:40 ` Xiubo Li
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Layton @ 2022-02-22 10:22 UTC (permalink / raw)
To: xiubli; +Cc: idryomov, vshankar, ceph-devel
On Tue, 2022-02-22 at 14:34 +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
>
> The global snaprealm would be created and then destroyed immediately
> every time when updating it.
>
Does this cause some sort of issue, or is it just inefficient?
> URL: https://tracker.ceph.com/issues/54362
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
> fs/ceph/mds_client.c | 2 +-
> fs/ceph/snap.c | 13 +++++++++++--
> fs/ceph/super.h | 2 +-
> include/linux/ceph/ceph_fs.h | 3 ++-
> 4 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 65bd43d4cafc..325f8071a324 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -4866,7 +4866,7 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc)
> mutex_unlock(&mdsc->mutex);
>
> ceph_cleanup_snapid_map(mdsc);
> - ceph_cleanup_empty_realms(mdsc);
> + ceph_cleanup_global_and_empty_realms(mdsc);
Please use tab indent.
>
> cancel_work_sync(&mdsc->cap_reclaim_work);
> cancel_delayed_work_sync(&mdsc->delayed_work); /* cancel timer */
> diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
> index 66a1a92cf579..cc9097c27052 100644
> --- a/fs/ceph/snap.c
> +++ b/fs/ceph/snap.c
> @@ -121,7 +121,11 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
> if (!realm)
> return ERR_PTR(-ENOMEM);
>
> - atomic_set(&realm->nref, 1); /* for caller */
> + /* Do not release the global dummy snaprealm until unmouting */
> + if (ino == CEPH_INO_GLOBAL_SNAPREALM)
> + atomic_set(&realm->nref, 2);
> + else
> + atomic_set(&realm->nref, 1);
> realm->ino = ino;
> INIT_LIST_HEAD(&realm->children);
> INIT_LIST_HEAD(&realm->child_item);
> @@ -261,9 +265,14 @@ static void __cleanup_empty_realms(struct ceph_mds_client *mdsc)
> spin_unlock(&mdsc->snap_empty_lock);
> }
>
> -void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc)
> +void ceph_cleanup_global_and_empty_realms(struct ceph_mds_client *mdsc)
> {
> + struct ceph_snap_realm *global_realm;
> +
> down_write(&mdsc->snap_rwsem);
> + global_realm = __lookup_snap_realm(mdsc, CEPH_INO_GLOBAL_SNAPREALM);
> + if (global_realm)
> + ceph_put_snap_realm(mdsc, global_realm);
> __cleanup_empty_realms(mdsc);
> up_write(&mdsc->snap_rwsem);
> }
> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> index baac800a6d11..250aefecd628 100644
> --- a/fs/ceph/super.h
> +++ b/fs/ceph/super.h
> @@ -942,7 +942,7 @@ extern void ceph_handle_snap(struct ceph_mds_client *mdsc,
> struct ceph_msg *msg);
> extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
> struct ceph_cap_snap *capsnap);
> -extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc);
> +extern void ceph_cleanup_global_and_empty_realms(struct ceph_mds_client *mdsc);
>
> extern struct ceph_snapid_map *ceph_get_snapid_map(struct ceph_mds_client *mdsc,
> u64 snap);
> diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
> index f14f9bc290e6..86bf82dbd8b8 100644
> --- a/include/linux/ceph/ceph_fs.h
> +++ b/include/linux/ceph/ceph_fs.h
> @@ -28,7 +28,8 @@
>
>
> #define CEPH_INO_ROOT 1
> -#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
> +#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
> +#define CEPH_INO_GLOBAL_SNAPREALM 3 /* global dummy snaprealm */
>
> /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
> #define CEPH_MAX_MON 31
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ceph: do not release the global snaprealm until unmounting
2022-02-22 10:22 ` Jeff Layton
@ 2022-02-22 10:40 ` Xiubo Li
0 siblings, 0 replies; 5+ messages in thread
From: Xiubo Li @ 2022-02-22 10:40 UTC (permalink / raw)
To: Jeff Layton; +Cc: idryomov, vshankar, ceph-devel
On 2/22/22 6:22 PM, Jeff Layton wrote:
> On Tue, 2022-02-22 at 14:34 +0800, xiubli@redhat.com wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> The global snaprealm would be created and then destroyed immediately
>> every time when updating it.
>>
> Does this cause some sort of issue, or is it just inefficient?
>
Just inefficient.
>> URL: https://tracker.ceph.com/issues/54362
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>> fs/ceph/mds_client.c | 2 +-
>> fs/ceph/snap.c | 13 +++++++++++--
>> fs/ceph/super.h | 2 +-
>> include/linux/ceph/ceph_fs.h | 3 ++-
>> 4 files changed, 15 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
>> index 65bd43d4cafc..325f8071a324 100644
>> --- a/fs/ceph/mds_client.c
>> +++ b/fs/ceph/mds_client.c
>> @@ -4866,7 +4866,7 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc)
>> mutex_unlock(&mdsc->mutex);
>>
>> ceph_cleanup_snapid_map(mdsc);
>> - ceph_cleanup_empty_realms(mdsc);
>> + ceph_cleanup_global_and_empty_realms(mdsc);
> Please use tab indent.
Sure, will fix it.
Thanks
- Xiubo
>
>>
>> cancel_work_sync(&mdsc->cap_reclaim_work);
>> cancel_delayed_work_sync(&mdsc->delayed_work); /* cancel timer */
>> diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
>> index 66a1a92cf579..cc9097c27052 100644
>> --- a/fs/ceph/snap.c
>> +++ b/fs/ceph/snap.c
>> @@ -121,7 +121,11 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
>> if (!realm)
>> return ERR_PTR(-ENOMEM);
>>
>> - atomic_set(&realm->nref, 1); /* for caller */
>> + /* Do not release the global dummy snaprealm until unmouting */
>> + if (ino == CEPH_INO_GLOBAL_SNAPREALM)
>> + atomic_set(&realm->nref, 2);
>> + else
>> + atomic_set(&realm->nref, 1);
>> realm->ino = ino;
>> INIT_LIST_HEAD(&realm->children);
>> INIT_LIST_HEAD(&realm->child_item);
>> @@ -261,9 +265,14 @@ static void __cleanup_empty_realms(struct ceph_mds_client *mdsc)
>> spin_unlock(&mdsc->snap_empty_lock);
>> }
>>
>> -void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc)
>> +void ceph_cleanup_global_and_empty_realms(struct ceph_mds_client *mdsc)
>> {
>> + struct ceph_snap_realm *global_realm;
>> +
>> down_write(&mdsc->snap_rwsem);
>> + global_realm = __lookup_snap_realm(mdsc, CEPH_INO_GLOBAL_SNAPREALM);
>> + if (global_realm)
>> + ceph_put_snap_realm(mdsc, global_realm);
>> __cleanup_empty_realms(mdsc);
>> up_write(&mdsc->snap_rwsem);
>> }
>> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
>> index baac800a6d11..250aefecd628 100644
>> --- a/fs/ceph/super.h
>> +++ b/fs/ceph/super.h
>> @@ -942,7 +942,7 @@ extern void ceph_handle_snap(struct ceph_mds_client *mdsc,
>> struct ceph_msg *msg);
>> extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
>> struct ceph_cap_snap *capsnap);
>> -extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc);
>> +extern void ceph_cleanup_global_and_empty_realms(struct ceph_mds_client *mdsc);
>>
>> extern struct ceph_snapid_map *ceph_get_snapid_map(struct ceph_mds_client *mdsc,
>> u64 snap);
>> diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
>> index f14f9bc290e6..86bf82dbd8b8 100644
>> --- a/include/linux/ceph/ceph_fs.h
>> +++ b/include/linux/ceph/ceph_fs.h
>> @@ -28,7 +28,8 @@
>>
>>
>> #define CEPH_INO_ROOT 1
>> -#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
>> +#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
>> +#define CEPH_INO_GLOBAL_SNAPREALM 3 /* global dummy snaprealm */
>>
>> /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
>> #define CEPH_MAX_MON 31
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-22 10:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 6:34 [PATCH 0/2] ceph: create the global dummy snaprealm once xiubli
2022-02-22 6:34 ` [PATCH 1/2] ceph: remove incorrect and unused CEPH_INO_DOTDOT macro xiubli
2022-02-22 6:34 ` [PATCH 2/2] ceph: do not release the global snaprealm until unmounting xiubli
2022-02-22 10:22 ` Jeff Layton
2022-02-22 10:40 ` Xiubo Li
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.