From ee3d62becab62e2ec083ebe4d1834f232270a525 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 23 Jun 2010 09:58:38 -0500 Subject: [PATCH] vos: Interpret VLOP_* lock flags 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 Reviewed-by: Jason Edgecombe Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- doc/man-pages/pod1/vos_examine.pod | 31 ++++++++++++++++++++++- doc/man-pages/pod1/vos_listvldb.pod | 31 ++++++++++++++++++++++- src/volser/vos.c | 38 +++++++++++++++++++++++------ 3 files changed, 90 insertions(+), 10 deletions(-) diff --git a/doc/man-pages/pod1/vos_examine.pod b/doc/man-pages/pod1/vos_examine.pod index d2f6f2827..1da1d681b 100644 --- a/doc/man-pages/pod1/vos_examine.pod +++ b/doc/man-pages/pod1/vos_examine.pod @@ -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. +If the VLDB entry is locked, the string C, 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 or a B command. + +=item Volume is locked for a release operation + +Indicates that the volume was locked due to a B command. + +=item Volume is locked for a backup operation + +Indicates that the volume was locked due to a B command. + +=item Volume is locked for a delete/misc operation + +Indicates that the volume was locked due to a B, B, B, B, B, B, B, or B command. + +=item Volume is locked for a dump/restore operation + +Indicates that the volume was locked due to a B or B +command. + +=back =back diff --git a/doc/man-pages/pod1/vos_listvldb.pod b/doc/man-pages/pod1/vos_listvldb.pod index 343ed965f..7d2694163 100644 --- a/doc/man-pages/pod1/vos_listvldb.pod +++ b/doc/man-pages/pod1/vos_listvldb.pod @@ -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. +If the VLDB entry is locked, the string C, 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 or a B command. + +=item Volume is locked for a release operation + +Indicates that the volume was locked due to a B command. + +=item Volume is locked for a backup operation + +Indicates that the volume was locked due to a B command. + +=item Volume is locked for a delete/misc operation + +Indicates that the volume was locked due to a B, B, B, B, B, B, B, or B command. + +=item Volume is locked for a dump/restore operation + +Indicates that the volume was locked due to a B or B +command. + +=back =back diff --git a/src/volser/vos.c b/src/volser/vos.c index 648606efe..a839b1769 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -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); } } -- 2.39.5