Commit bba0cd0e authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Sage Weil

ceph: Update max_len with minimum required size

encode_fh on error should update max_len with minimum required
size, so that caller can redo the call with the reallocated buffer.
This is required with open by handle patch series
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 92923dcb
...@@ -62,13 +62,16 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, ...@@ -62,13 +62,16 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
*max_len = connected_handle_length; *max_len = connected_handle_length;
type = 2; type = 2;
} else if (*max_len >= handle_length) { } else if (*max_len >= handle_length) {
if (connectable) if (connectable) {
*max_len = connected_handle_length;
return 255; return 255;
}
dout("encode_fh %p\n", dentry); dout("encode_fh %p\n", dentry);
fh->ino = ceph_ino(dentry->d_inode); fh->ino = ceph_ino(dentry->d_inode);
*max_len = handle_length; *max_len = handle_length;
type = 1; type = 1;
} else { } else {
*max_len = handle_length;
return 255; return 255;
} }
return type; return type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment