]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
fs: Report default storebehind when errors exist
authorAndrew Deason <adeason@sinenomine.net>
Mon, 7 May 2012 20:49:34 +0000 (15:49 -0500)
committerDerrick Brashear <shadow@dementix.org>
Wed, 9 May 2012 00:53:53 +0000 (17:53 -0700)
After 904c9fbe, we no longer print out the default store asynchrony
when any of the supplied paths results in a pioctl error. However, if
just one (or a few) of the paths supplied results in an error (such
as, the path does not exist), this does not prevent us from reporting
the default value.

Instead, keep track of whether or not we have a valid value, and try
to determine the default if we haven't already by the end of
StoreBehindCmd, and print it out.

Reviewed-on: http://gerrit.openafs.org/7376
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 427f53eea7f9c05e7b1913c91d57777d72bc30b2)

Change-Id: I04bebe60fbb275ca44caeed9b8696283c4ded36b
Reviewed-on: http://gerrit.openafs.org/7384
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/venus/fs.c

index 31b2f56217b1217d4ce2ecf60374eec2d3be90b5..7439028cbe31e5f6148b8e36d1521984466a35a7 100644 (file)
@@ -3305,6 +3305,7 @@ StoreBehindCmd(struct cmd_syndesc *as, void *arock)
     afs_int32 allfiles;
     char *t;
     int error = 0;
+    int async_default = -1;
 
     tsb.sb_thisfile = -1;
     ti = as->parms[0].items;   /* -kbytes */
@@ -3365,14 +3366,18 @@ StoreBehindCmd(struct cmd_syndesc *as, void *arock)
            continue;
        }
 
-       if (verbose && (blob.out_size == sizeof(tsb2))) {
-           if (tsb2.sb_thisfile == -1) {
-               fprintf(stdout, "Will store %s according to default.\n",
-                       ti->data);
+       if (blob.out_size == sizeof(tsb2)) {
+           async_default = tsb2.sb_default;
+
+           if (verbose) {
+               if (tsb2.sb_thisfile == -1) {
+                   fprintf(stdout, "Will store %s according to default.\n",
+                           ti->data);
            } else {
-               fprintf(stdout,
-                       "Will store up to %d kbytes of %s asynchronously.\n",
-                       (tsb2.sb_thisfile / 1024), ti->data);
+                   fprintf(stdout,
+                           "Will store up to %d kbytes of %s asynchronously.\n",
+                           (tsb2.sb_thisfile / 1024), ti->data);
+               }
            }
        }
     }
@@ -3380,7 +3385,7 @@ StoreBehindCmd(struct cmd_syndesc *as, void *arock)
     /* If no files - make at least one pioctl call, or
      * set the allfiles default if we need to.
      */
-    if (!as->parms[1].items || (allfiles != -1)) {
+    if (async_default < 0 || (allfiles != -1)) {
        tsb.sb_default = allfiles;
         memset(&tsb2, 0, sizeof(tsb2));
        blob.out = (char *)&tsb2;
@@ -3389,13 +3394,16 @@ StoreBehindCmd(struct cmd_syndesc *as, void *arock)
        if (code) {
            Die(errno, ((allfiles == -1) ? 0 : "-allfiles"));
            error = 1;
+
+       } else if (blob.out_size == sizeof(tsb2)) {
+           async_default = tsb2.sb_default;
        }
     }
 
     /* Having no arguments also reports the default store asynchrony */
-    if (!error && verbose && (blob.out_size == sizeof(tsb2))) {
+    if (async_default >= 0 && verbose) {
        fprintf(stdout, "Default store asynchrony is %d kbytes.\n",
-               (tsb2.sb_default / 1024));
+               (async_default / 1024));
     }
 
     return error;