Skip to content

Commit 5b7ad87

Browse files
committed
Merge tag 'afs-fixes-20231124' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull AFS fixes from David Howells: - Fix the afs_server_list struct to be cleaned up with RCU - Fix afs to translate a no-data result from a DNS lookup into ENOENT, not EDESTADDRREQ for consistency with OpenAFS - Fix afs to translate a negative DNS lookup result into ENOENT rather than EDESTADDRREQ - Fix file locking on R/O volumes to operate in local mode as the server doesn't handle exclusive locks on such files - Set SB_RDONLY on superblocks for RO and Backup volumes so that the VFS can see that they're read only * tag 'afs-fixes-20231124' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: afs: Mark a superblock for an R/O or Backup volume as SB_RDONLY afs: Fix file locking on R/O volumes to operate in local mode afs: Return ENOENT if no cell DNS record can be found afs: Make error on cell lookup failure consistent with OpenAFS afs: Fix afs_server_list to be cleaned up with RCU
2 parents fa2b906 + 68516f6 commit 5b7ad87

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

fs/afs/dynroot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ static int afs_probe_cell_name(struct dentry *dentry)
132132

133133
ret = dns_query(net->net, "afsdb", name, len, "srv=1",
134134
NULL, NULL, false);
135-
if (ret == -ENODATA)
136-
ret = -EDESTADDRREQ;
135+
if (ret == -ENODATA || ret == -ENOKEY)
136+
ret = -ENOENT;
137137
return ret;
138138
}
139139

fs/afs/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ struct afs_server_entry {
553553
};
554554

555555
struct afs_server_list {
556+
struct rcu_head rcu;
556557
afs_volid_t vids[AFS_MAXTYPES]; /* Volume IDs */
557558
refcount_t usage;
558559
unsigned char nr_servers;

fs/afs/server_list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void afs_put_serverlist(struct afs_net *net, struct afs_server_list *slist)
1717
for (i = 0; i < slist->nr_servers; i++)
1818
afs_unuse_server(net, slist->servers[i].server,
1919
afs_server_trace_put_slist);
20-
kfree(slist);
20+
kfree_rcu(slist, rcu);
2121
}
2222
}
2323

fs/afs/super.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ static int afs_validate_fc(struct fs_context *fc)
407407
return PTR_ERR(volume);
408408

409409
ctx->volume = volume;
410+
if (volume->type != AFSVL_RWVOL) {
411+
ctx->flock_mode = afs_flock_mode_local;
412+
fc->sb_flags |= SB_RDONLY;
413+
}
410414
}
411415

412416
return 0;

fs/afs/vl_rotate.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ static bool afs_start_vl_iteration(struct afs_vl_cursor *vc)
5858
}
5959

6060
/* Status load is ordered after lookup counter load */
61+
if (cell->dns_status == DNS_LOOKUP_GOT_NOT_FOUND) {
62+
pr_warn("No record of cell %s\n", cell->name);
63+
vc->error = -ENOENT;
64+
return false;
65+
}
66+
6167
if (cell->dns_source == DNS_RECORD_UNAVAILABLE) {
6268
vc->error = -EDESTADDRREQ;
6369
return false;
@@ -285,6 +291,7 @@ bool afs_select_vlserver(struct afs_vl_cursor *vc)
285291
*/
286292
static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
287293
{
294+
struct afs_cell *cell = vc->cell;
288295
static int count;
289296
int i;
290297

@@ -294,6 +301,9 @@ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
294301

295302
rcu_read_lock();
296303
pr_notice("EDESTADDR occurred\n");
304+
pr_notice("CELL: %s err=%d\n", cell->name, cell->error);
305+
pr_notice("DNS: src=%u st=%u lc=%x\n",
306+
cell->dns_source, cell->dns_status, cell->dns_lookup_count);
297307
pr_notice("VC: ut=%lx ix=%u ni=%hu fl=%hx err=%hd\n",
298308
vc->untried, vc->index, vc->nr_iterations, vc->flags, vc->error);
299309

0 commit comments

Comments
 (0)