ceph: initialize pathlen variable in reconnect_caps_cb
PATCH 1/1 ceph: initialize pathlen variable in reconnect_caps_cb
From: Xiubo Li <[email protected]>
Silence the potential compiler warning.
--- fs/ceph/mds_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +1 -1
@@ -3711,7 +3711,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap,struct ceph_pagelist *pagelist = recon_state->pagelist;struct dentry *dentry;char *path; -int pathlen, err; +int pathlen =0 , err;u64 pathbase;u64 snap_follows;
Signature · 1 line
2.31.1
Quoted 6 lines · On Tue, 2021-11-30 at 19:20 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
Silence the potential compiler warning.
Fixes a33f6432b3a6 (ceph: encode inodes' parent/d_name in cap reconnect message)Signed-off-by Xiubo Li <[email protected]>
Is this something we need to fix? AFAICT, there is no bug here.
In the case where ceph_mdsc_build_path returns an error, "path" will be an ERR_PTR and then ceph_mdsc_free_path will be a no-op. If we do need to take this, we should probably also credit Dan for finding it.
Quoted 9 lines
--- fs/ceph/mds_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/mds_client.c +0
-0
fs/ceph/mds_client.c static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, · line 3717
Quoted 8 lines
fs/ceph/mds_client.c +1
-1@@ -3711,7 +3711,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap,struct ceph_pagelist *pagelist = recon_state->pagelist;struct dentry *dentry;char *path; -int pathlen, err; +int pathlen =0 , err;u64 pathbase;u64 snap_follows;
If we do take this, you can also get rid of the place where pathlen is set in the !dentry case.
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 5 lines · Jeff Layton
Quoted 4 lines · On Tue, 2021-11-30 at 19:20 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
Silence the potential compiler warning.
Quoted 8 lines
Quoted 2 lines
Fixes a33f6432b3a6 (ceph: encode inodes' parent/d_name in cap reconnect message)Signed-off-by Xiubo Li <[email protected]>Is this something we need to fix? AFAICT, there is no bug here.
In the case where
ceph_mdsc_build_pathreturns an error, "path" will be anERR_PTRand thenceph_mdsc_free_pathwill be a no-op. If we do need to take this, we should probably also credit Dan for finding it.
As I remembered, when I was paying the gluster-block project, the similar cases will always give a warning like this with code sanity checking.
Quoted 20 lines
Quoted 9 lines
--- fs/ceph/mds_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/mds_client.c +0
-0fs/ceph/mds_client.c static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, · line 3717
Quoted 8 lines
fs/ceph/mds_client.c +1
-1@@ -3711,7 +3711,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap,struct ceph_pagelist *pagelist = recon_state->pagelist;struct dentry *dentry;char *path; -int pathlen, err; +int pathlen =0 , err;u64 pathbase;u64 snap_follows;If we do take this, you can also get rid of the place where pathlen is set in the !dentry case.
Quoted 10 lines · Xiubo Li
Quoted 9 lines · Jeff Layton
Quoted 6 lines · On Tue, 2021-11-30 at 19:20 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
Silence the potential compiler warning.
Fixes a33f6432b3a6 (ceph: encode inodes' parent/d_name in cap reconnect message)Signed-off-by Xiubo Li <[email protected]>Is this something we need to fix? AFAICT, there is no bug here.
Quoted 8 lines
Quoted 4 lines
In the case where
ceph_mdsc_build_pathreturns an error, "path" will be anERR_PTRand thenceph_mdsc_free_pathwill be a no-op. If we do need to take this, we should probably also credit Dan for finding it.As I remembered, when I was paying the gluster-block project, the similar cases will always give a warning like this with code sanity checking.
Meh...ok.
I merged a slightly altered version of the patch into the testing branch, revised the changelog and gave Dan reported-by credit. Please take a look when you get a chance and let me know if anything is amiss.
Thanks,
Quoted 21 lines
Quoted 20 lines
Quoted 9 lines
--- fs/ceph/mds_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/mds_client.c +0
-0fs/ceph/mds_client.c static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, · line 3717
Quoted 8 lines
fs/ceph/mds_client.c +1
-1@@ -3711,7 +3711,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap,struct ceph_pagelist *pagelist = recon_state->pagelist;struct dentry *dentry;char *path; -int pathlen, err; +int pathlen =0 , err;u64 pathbase;u64 snap_follows;If we do take this, you can also get rid of the place where pathlen is set in the !dentry case.
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 9 lines · Xiubo Li
Quoted 7 lines · Jeff Layton
Quoted 6 lines · On Tue, 2021-11-30 at 19:20 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
Silence the potential compiler warning.
Fixes a33f6432b3a6 (ceph: encode inodes' parent/d_name in cap reconnect message)Signed-off-by Xiubo Li <[email protected]>
Quoted 9 lines
Quoted 6 lines
Is this something we need to fix? AFAICT, there is no bug here.
In the case where
ceph_mdsc_build_pathreturns an error, "path" will be anERR_PTRand thenceph_mdsc_free_pathwill be a no-op. If we do need to take this, we should probably also credit Dan for finding it.As I remembered, when I was paying the gluster-block project, the similar cases will always give a warning like this with code sanity checking.
I think I was just having a discussion about this. Do you remember what the warnings look like?
regards,
dan carpenter