afs: Return ENOENT if no cell DNS record can be found

[ Upstream commit 0167236e7d66c5e1e85d902a6abc2529b7544539 ]

Make AFS return error ENOENT if no cell SRV or AFSDB DNS record (or
cellservdb config file record) can be found rather than returning
EDESTADDRREQ.

Also add cell name lookup info to the cursor dump.

Fixes: d5c32c89b2 ("afs: Fix cell DNS lookup")
Reported-by: Markus Suvanto <markus.suvanto@gmail.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216637
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
David Howells 2023-10-26 01:25:07 +01:00 committed by Greg Kroah-Hartman
parent 3680d10b41
commit 54ffe881d7

View File

@ -58,6 +58,12 @@ static bool afs_start_vl_iteration(struct afs_vl_cursor *vc)
} }
/* Status load is ordered after lookup counter load */ /* Status load is ordered after lookup counter load */
if (cell->dns_status == DNS_LOOKUP_GOT_NOT_FOUND) {
pr_warn("No record of cell %s\n", cell->name);
vc->error = -ENOENT;
return false;
}
if (cell->dns_source == DNS_RECORD_UNAVAILABLE) { if (cell->dns_source == DNS_RECORD_UNAVAILABLE) {
vc->error = -EDESTADDRREQ; vc->error = -EDESTADDRREQ;
return false; return false;
@ -276,6 +282,7 @@ failed:
*/ */
static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc) static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
{ {
struct afs_cell *cell = vc->cell;
static int count; static int count;
int i; int i;
@ -285,6 +292,9 @@ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
rcu_read_lock(); rcu_read_lock();
pr_notice("EDESTADDR occurred\n"); pr_notice("EDESTADDR occurred\n");
pr_notice("CELL: %s err=%d\n", cell->name, cell->error);
pr_notice("DNS: src=%u st=%u lc=%x\n",
cell->dns_source, cell->dns_status, cell->dns_lookup_count);
pr_notice("VC: ut=%lx ix=%u ni=%hu fl=%hx err=%hd\n", pr_notice("VC: ut=%lx ix=%u ni=%hu fl=%hx err=%hd\n",
vc->untried, vc->index, vc->nr_iterations, vc->flags, vc->error); vc->untried, vc->index, vc->nr_iterations, vc->flags, vc->error);