From d72846bb0a0650f96362ba190fa8f1fed90ba7d5 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Wed, 3 Feb 2010 00:37:20 +0000 Subject: [PATCH] Fix fs storebehind on files with 2 or more servers fs storebehind didn't allocate a large enough buffer for its call to VIOCWHERIS. This meant that when it was called on a file with more than one server (one in a readonly volume), it would error out with E2BIG, rather than a more appropriate message. Fix this, by using the generic 'space' buffer for the VIOCWHERIS call. Change-Id: Ida0d40175f07ad528720ca700db5b5027b975095 Reviewed-on: http://gerrit.openafs.org/1224 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/venus/fs.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/venus/fs.c b/src/venus/fs.c index b28d819..cc394f0 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -3276,13 +3276,14 @@ StoreBehindCmd(struct cmd_syndesc *as, void *arock) verbose = 1; blob.in = (char *)&tsb; - blob.out = (char *)&tsb2; - blob.in_size = blob.out_size = sizeof(struct sbstruct); - memset(&tsb2, 0, sizeof(tsb2)); + blob.in_size = sizeof(struct sbstruct); /* once per -file */ for (ti = as->parms[1].items; ti; ti = ti->next) { /* Do this solely to see if the file is there */ + + blob.out = space; + blob.out_size = AFS_PIOCTL_MAXSIZE; code = pioctl(ti->data, VIOCWHEREIS, &blob, 1); if (code) { Die(errno, ti->data); @@ -3290,6 +3291,9 @@ StoreBehindCmd(struct cmd_syndesc *as, void *arock) continue; } + memset(&tsb2, 0, sizeof(tsb2)); + blob.out = (char *)&tsb2; + blob.out_size = sizeof(struct sbstruct); code = pioctl(ti->data, VIOC_STORBEHIND, &blob, 1); if (code) { Die(errno, ti->data); @@ -3314,6 +3318,9 @@ StoreBehindCmd(struct cmd_syndesc *as, void *arock) */ if (!as->parms[1].items || (allfiles != -1)) { tsb.sb_default = allfiles; + memset(&tsb2, 0, sizeof(tsb2)); + blob.out = (char *)&tsb2; + blob.out_size = sizeof(struct sbstruct); code = pioctl(0, VIOC_STORBEHIND, &blob, 1); if (code) { Die(errno, ((allfiles == -1) ? 0 : "-allfiles")); -- 1.9.4