Skip to contentSkip to conversation

ceph:Fix error handling in the function ceph_readddir_prepopulate

PATCH Yan, Zheng 1 participant 1 message Nov 9, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Yan, Zheng

author
#1 lore raw
Quoted 24 lines · Nicholas Krause

This fixes error handling in the function ceph_readddir_prepopulate to properly check if the call to the function ceph_fill_dirfrag has failed by returning a error code. Further more if this does arise jump to the goto label, out of the function ceph_readdir_prepopulate in order to clean up previously allocated resources by this function before returning to the caller this errror code in order for all callers to be now aware and able to handle this failure in their own intended error paths.

---
fs/ceph/inode.c | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
fs/ceph/inode.c +0 -0
index 96d2bd8..7738be6 100644
@@ -1417,8 +1417,11 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
 	} else {
 		dout("readdir_prepopulate %d items under dn %p\n",

fs/ceph/inode.c int ceph_readdir_prepopulate(struct ceph_mds_request *req, · line 1426

Quoted 10 lines
fs/ceph/inode.c +5 -2
 		     rinfo->dir_nr, parent);
-		if (rinfo->dir_dir)
-			ceph_fill_dirfrag(d_inode(parent), rinfo->dir_dir);
+		if (rinfo->dir_dir) {
+			err = ceph_fill_dirfrag(d_inode(parent), rinfo->dir_dir);
+			if (err)
+				goto out;
+		}
 	}
 

ceph_fill_dirfrag() failure is not fatal. I think it’s better to not skip later code when it happens.

Regards
Yan, Zheng

Quoted 4 lines
fs/ceph/inode.c +0 -0
 	if (ceph_frag_is_leftmost(frag) && req->r_readdir_offset == 2) {
Signature · 1 line
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html