* [PATCH 1/2] ceph: Fix return value of encode_fh function
@ 2010-10-05 10:33 Aneesh Kumar K.V
2010-10-05 10:33 ` [PATCH 2/2] ceph: Update max_len with minimum required size Aneesh Kumar K.V
2010-10-05 17:02 ` [PATCH 1/2] ceph: Fix return value of encode_fh function Sage Weil
0 siblings, 2 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2010-10-05 10:33 UTC (permalink / raw)
To: ceph-devel, sage; +Cc: Aneesh Kumar K.V
encode_fh function should return 255 on error as done by other file
system to indicate EOVERFLOW. Also max_len is in sizeof(u32) units
and not in bytes.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/ceph/export.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 4480cb1..387c582 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -42,32 +42,34 @@ struct ceph_nfs_confh {
static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
int connectable)
{
+ int type;
struct ceph_nfs_fh *fh = (void *)rawfh;
struct ceph_nfs_confh *cfh = (void *)rawfh;
struct dentry *parent = dentry->d_parent;
struct inode *inode = dentry->d_inode;
- int type;
+ int connected_handle_length = sizeof(*cfh)/4;
+ int handle_length = sizeof(*fh)/4;
/* don't re-export snaps */
if (ceph_snap(inode) != CEPH_NOSNAP)
return -EINVAL;
- if (*max_len >= sizeof(*cfh)) {
+ if (*max_len >= connected_handle_length) {
dout("encode_fh %p connectable\n", dentry);
cfh->ino = ceph_ino(dentry->d_inode);
cfh->parent_ino = ceph_ino(parent->d_inode);
cfh->parent_name_hash = parent->d_name.hash;
- *max_len = sizeof(*cfh);
+ *max_len = connected_handle_length;
type = 2;
- } else if (*max_len > sizeof(*fh)) {
+ } else if (*max_len >= handle_length) {
if (connectable)
- return -ENOSPC;
+ return 255;
dout("encode_fh %p\n", dentry);
fh->ino = ceph_ino(dentry->d_inode);
- *max_len = sizeof(*fh);
+ *max_len = handle_length;
type = 1;
} else {
- return -ENOSPC;
+ return 255;
}
return type;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] ceph: Update max_len with minimum required size
2010-10-05 10:33 [PATCH 1/2] ceph: Fix return value of encode_fh function Aneesh Kumar K.V
@ 2010-10-05 10:33 ` Aneesh Kumar K.V
2010-10-05 17:02 ` [PATCH 1/2] ceph: Fix return value of encode_fh function Sage Weil
1 sibling, 0 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2010-10-05 10:33 UTC (permalink / raw)
To: ceph-devel, sage; +Cc: Aneesh Kumar K.V
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: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/ceph/export.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 387c582..e38423e 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -62,13 +62,16 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
*max_len = connected_handle_length;
type = 2;
} else if (*max_len >= handle_length) {
- if (connectable)
+ if (connectable) {
+ *max_len = connected_handle_length;
return 255;
+ }
dout("encode_fh %p\n", dentry);
fh->ino = ceph_ino(dentry->d_inode);
*max_len = handle_length;
type = 1;
} else {
+ *max_len = handle_length;
return 255;
}
return type;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/2] ceph: Fix return value of encode_fh function
2010-10-05 10:33 [PATCH 1/2] ceph: Fix return value of encode_fh function Aneesh Kumar K.V
2010-10-05 10:33 ` [PATCH 2/2] ceph: Update max_len with minimum required size Aneesh Kumar K.V
@ 2010-10-05 17:02 ` Sage Weil
2010-10-05 17:45 ` Aneesh Kumar K. V
1 sibling, 1 reply; 4+ messages in thread
From: Sage Weil @ 2010-10-05 17:02 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: ceph-devel
Aneesh,
I'll add these to my tree (unless you want to send them separately?).
Thanks!
sage
On Tue, 5 Oct 2010, Aneesh Kumar K.V wrote:
> encode_fh function should return 255 on error as done by other file
> system to indicate EOVERFLOW. Also max_len is in sizeof(u32) units
> and not in bytes.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
> fs/ceph/export.c | 16 +++++++++-------
> 1 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/fs/ceph/export.c b/fs/ceph/export.c
> index 4480cb1..387c582 100644
> --- a/fs/ceph/export.c
> +++ b/fs/ceph/export.c
> @@ -42,32 +42,34 @@ struct ceph_nfs_confh {
> static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
> int connectable)
> {
> + int type;
> struct ceph_nfs_fh *fh = (void *)rawfh;
> struct ceph_nfs_confh *cfh = (void *)rawfh;
> struct dentry *parent = dentry->d_parent;
> struct inode *inode = dentry->d_inode;
> - int type;
> + int connected_handle_length = sizeof(*cfh)/4;
> + int handle_length = sizeof(*fh)/4;
>
> /* don't re-export snaps */
> if (ceph_snap(inode) != CEPH_NOSNAP)
> return -EINVAL;
>
> - if (*max_len >= sizeof(*cfh)) {
> + if (*max_len >= connected_handle_length) {
> dout("encode_fh %p connectable\n", dentry);
> cfh->ino = ceph_ino(dentry->d_inode);
> cfh->parent_ino = ceph_ino(parent->d_inode);
> cfh->parent_name_hash = parent->d_name.hash;
> - *max_len = sizeof(*cfh);
> + *max_len = connected_handle_length;
> type = 2;
> - } else if (*max_len > sizeof(*fh)) {
> + } else if (*max_len >= handle_length) {
> if (connectable)
> - return -ENOSPC;
> + return 255;
> dout("encode_fh %p\n", dentry);
> fh->ino = ceph_ino(dentry->d_inode);
> - *max_len = sizeof(*fh);
> + *max_len = handle_length;
> type = 1;
> } else {
> - return -ENOSPC;
> + return 255;
> }
> return type;
> }
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-05 17:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-05 10:33 [PATCH 1/2] ceph: Fix return value of encode_fh function Aneesh Kumar K.V
2010-10-05 10:33 ` [PATCH 2/2] ceph: Update max_len with minimum required size Aneesh Kumar K.V
2010-10-05 17:02 ` [PATCH 1/2] ceph: Fix return value of encode_fh function Sage Weil
2010-10-05 17:45 ` Aneesh Kumar K. V
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.