]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vos: Interpret VLOP_* lock flags
authorAndrew Deason <adeason@sinenomine.net>
Wed, 23 Jun 2010 14:58:38 +0000 (09:58 -0500)
committerDerrick Brashear <shadow@dementia.org>
Wed, 23 Jun 2010 22:01:09 +0000 (15:01 -0700)
When a volume is locked in the VLDB, we are given flags for the reason
why the lock was set. Make vos interpret and output this reason.

This adds output to any vos command that previously printed that a
volume was LOCKED. It now outputs, for example,

    Volume is currently LOCKED
    Volume is locked for a delete/misc operation

Change-Id: Ie3a6f804a3e3a551840975c3689b24d3916891df
Reviewed-on: http://gerrit.openafs.org/2235
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jason Edgecombe <jason@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
doc/man-pages/pod1/vos_examine.pod
doc/man-pages/pod1/vos_listvldb.pod
src/volser/vos.c

index d2f6f282776448044cc32035dd3f372c62fb2867..1da1d681b96e1759330aa91dca3f606a9752950b 100644 (file)
@@ -315,7 +315,36 @@ that this site did receive the correct new version of the volume.
 
 =item *
 
-If the VLDB entry is locked, the string C<Volume is currently LOCKED>.
+If the VLDB entry is locked, the string C<Volume is currently LOCKED>, as
+well as (in OpenAFS 1.5.75 and later) one or more of the following strings:
+
+=over 4
+
+=item Volume is locked for a move operation
+
+Indicates that the volume was locked due to a B<vos move> or a B<vos
+convertROtoRW> command.
+
+=item Volume is locked for a release operation
+
+Indicates that the volume was locked due to a B<vos release> command.
+
+=item Volume is locked for a backup operation
+
+Indicates that the volume was locked due to a B<vos backup> command.
+
+=item Volume is locked for a delete/misc operation
+
+Indicates that the volume was locked due to a B<vos delentry>, B<vos
+addsite>, B<vos remsite>, B<vos changeloc>, B<vos syncvldb>, B<vos
+syncserv>, B<vos rename>, or B<vos lock> command.
+
+=item Volume is locked for a dump/restore operation
+
+Indicates that the volume was locked due to a B<vos dump> or B<vos restore>
+command.
+
+=back
 
 =back
 
index 343ed965fbcad73eed49d81dedd9f12bab5f55d5..7d26941637146a034d34b0d5b8963ffdc610d51a 100644 (file)
@@ -223,7 +223,36 @@ that this site did receive the correct new version of the volume.
 
 =item *
 
-If the VLDB entry is locked, the string C<Volume is currently LOCKED>.
+If the VLDB entry is locked, the string C<Volume is currently LOCKED>, as
+well as (in OpenAFS 1.5.75 and later) one or more of the following strings:
+
+=over 4
+
+=item Volume is locked for a move operation
+
+Indicates that the volume was locked due to a B<vos move> or a B<vos
+convertROtoRW> command.
+
+=item Volume is locked for a release operation
+
+Indicates that the volume was locked due to a B<vos release> command.
+
+=item Volume is locked for a backup operation
+
+Indicates that the volume was locked due to a B<vos backup> command.
+
+=item Volume is locked for a delete/misc operation
+
+Indicates that the volume was locked due to a B<vos delentry>, B<vos
+addsite>, B<vos remsite>, B<vos changeloc>, B<vos syncvldb>, B<vos
+syncserv>, B<vos rename>, or B<vos lock> command.
+
+=item Volume is locked for a dump/restore operation
+
+Indicates that the volume was locked due to a B<vos dump> or B<vos restore>
+command.
+
+=back
 
 =back
 
index 648606efe23857a31edc2ffbc777411e79a29151..a839b1769e0d3e9062c233522b954ad828953a17 100644 (file)
@@ -1409,13 +1409,38 @@ GetServerAndPart(struct nvldbentry *entry, int voltype, afs_int32 *server,
     return;
 }
 
+static void
+PrintLocked(afs_int32 aflags)
+{
+    afs_int32 flags = aflags & VLOP_ALLOPERS;
+
+    if (flags) {
+       fprintf(STDOUT, "    Volume is currently LOCKED  \n");
+
+       if (flags & VLOP_MOVE) {
+           fprintf(STDOUT, "    Volume is locked for a move operation\n");
+       }
+       if (flags & VLOP_RELEASE) {
+           fprintf(STDOUT, "    Volume is locked for a release operation\n");
+       }
+       if (flags & VLOP_BACKUP) {
+           fprintf(STDOUT, "    Volume is locked for a backup operation\n");
+       }
+       if (flags & VLOP_DELETE) {
+           fprintf(STDOUT, "    Volume is locked for a delete/misc operation\n");
+       }
+       if (flags & VLOP_DUMP) {
+           fprintf(STDOUT, "    Volume is locked for a dump/restore operation\n");
+       }
+    }
+}
+
 static void
 PostVolumeStats(struct nvldbentry *entry)
 {
     SubEnumerateEntry(entry);
     /* Check for VLOP_ALLOPERS */
-    if (entry->flags & VLOP_ALLOPERS)
-       fprintf(STDOUT, "    Volume is currently LOCKED  \n");
+    PrintLocked(entry->flags);
     return;
 }
 
@@ -3900,8 +3925,7 @@ VolumeInfoCmd(char *name)
      * If VLOP_ALLOPERS is set, the entry is locked.
      * Leave this routine as is, but put in correct check.
      */
-    if (entry.flags & VLOP_ALLOPERS)
-       fprintf(STDOUT, "    Volume is currently LOCKED  \n");
+    PrintLocked(entry.flags);
 
     return 0;
 }
@@ -4536,8 +4560,7 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
                MapHostToNetwork(vllist);
                EnumerateEntry(vllist);
 
-               if (vllist->flags & VLOP_ALLOPERS)
-                   fprintf(STDOUT, "    Volume is currently LOCKED  \n");
+               PrintLocked(vllist->flags);
            }
        }
 
@@ -4585,8 +4608,7 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
            MapHostToNetwork(vllist);
            EnumerateEntry(vllist);
 
-           if (vllist->flags & VLOP_ALLOPERS)
-               fprintf(STDOUT, "    Volume is currently LOCKED  \n");
+           PrintLocked(vllist->flags);
        }
     }