aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Dionne <marc.dionne@auristor.com>2018-05-16 10:04:23 -0400
committerDavid Howells <dhowells@redhat.com>2018-05-16 16:35:23 -0400
commit1fba5868eed82766fb374c7d367166706f9269d5 (patch)
treed15a64ee63fb158a569a0903749111f2135cc2c5
parent378831e4daec75fbba6d3612bcf3b4dd00ddbf08 (diff)
afs: Fix mounting of backup volumes
In theory the AFS_VLSF_BACKVOL flag for a server in a vldb entry would indicate the presence of a backup volume on that server. In practice however, this flag is never set, and the presence of a backup volume is implied by the entry having AFS_VLF_BACKEXISTS set, for the server that hosts the read-write volume (has AFS_VLSF_RWVOL). Signed-off-by: Marc Dionne <marc.dionne@auristor.com> Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--fs/afs/vlclient.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c
index 1ed7e2fd2f35..c3b740813fc7 100644
--- a/fs/afs/vlclient.c
+++ b/fs/afs/vlclient.c
@@ -23,7 +23,7 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
23 struct afs_uvldbentry__xdr *uvldb; 23 struct afs_uvldbentry__xdr *uvldb;
24 struct afs_vldb_entry *entry; 24 struct afs_vldb_entry *entry;
25 bool new_only = false; 25 bool new_only = false;
26 u32 tmp, nr_servers; 26 u32 tmp, nr_servers, vlflags;
27 int i, ret; 27 int i, ret;
28 28
29 _enter(""); 29 _enter("");
@@ -55,6 +55,7 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
55 new_only = true; 55 new_only = true;
56 } 56 }
57 57
58 vlflags = ntohl(uvldb->flags);
58 for (i = 0; i < nr_servers; i++) { 59 for (i = 0; i < nr_servers; i++) {
59 struct afs_uuid__xdr *xdr; 60 struct afs_uuid__xdr *xdr;
60 struct afs_uuid *uuid; 61 struct afs_uuid *uuid;
@@ -64,12 +65,13 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
64 if (tmp & AFS_VLSF_DONTUSE || 65 if (tmp & AFS_VLSF_DONTUSE ||
65 (new_only && !(tmp & AFS_VLSF_NEWREPSITE))) 66 (new_only && !(tmp & AFS_VLSF_NEWREPSITE)))
66 continue; 67 continue;
67 if (tmp & AFS_VLSF_RWVOL) 68 if (tmp & AFS_VLSF_RWVOL) {
68 entry->fs_mask[i] |= AFS_VOL_VTM_RW; 69 entry->fs_mask[i] |= AFS_VOL_VTM_RW;
70 if (vlflags & AFS_VLF_BACKEXISTS)
71 entry->fs_mask[i] |= AFS_VOL_VTM_BAK;
72 }
69 if (tmp & AFS_VLSF_ROVOL) 73 if (tmp & AFS_VLSF_ROVOL)
70 entry->fs_mask[i] |= AFS_VOL_VTM_RO; 74 entry->fs_mask[i] |= AFS_VOL_VTM_RO;
71 if (tmp & AFS_VLSF_BACKVOL)
72 entry->fs_mask[i] |= AFS_VOL_VTM_BAK;
73 if (!entry->fs_mask[i]) 75 if (!entry->fs_mask[i])
74 continue; 76 continue;
75 77
@@ -89,15 +91,14 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
89 for (i = 0; i < AFS_MAXTYPES; i++) 91 for (i = 0; i < AFS_MAXTYPES; i++)
90 entry->vid[i] = ntohl(uvldb->volumeId[i]); 92 entry->vid[i] = ntohl(uvldb->volumeId[i]);
91 93
92 tmp = ntohl(uvldb->flags); 94 if (vlflags & AFS_VLF_RWEXISTS)
93 if (tmp & AFS_VLF_RWEXISTS)
94 __set_bit(AFS_VLDB_HAS_RW, &entry->flags); 95 __set_bit(AFS_VLDB_HAS_RW, &entry->flags);
95 if (tmp & AFS_VLF_ROEXISTS) 96 if (vlflags & AFS_VLF_ROEXISTS)
96 __set_bit(AFS_VLDB_HAS_RO, &entry->flags); 97 __set_bit(AFS_VLDB_HAS_RO, &entry->flags);
97 if (tmp & AFS_VLF_BACKEXISTS) 98 if (vlflags & AFS_VLF_BACKEXISTS)
98 __set_bit(AFS_VLDB_HAS_BAK, &entry->flags); 99 __set_bit(AFS_VLDB_HAS_BAK, &entry->flags);
99 100
100 if (!(tmp & (AFS_VLF_RWEXISTS | AFS_VLF_ROEXISTS | AFS_VLF_BACKEXISTS))) { 101 if (!(vlflags & (AFS_VLF_RWEXISTS | AFS_VLF_ROEXISTS | AFS_VLF_BACKEXISTS))) {
101 entry->error = -ENOMEDIUM; 102 entry->error = -ENOMEDIUM;
102 __set_bit(AFS_VLDB_QUERY_ERROR, &entry->flags); 103 __set_bit(AFS_VLDB_QUERY_ERROR, &entry->flags);
103 } 104 }