diff mbox series

[3/5] afs: Return ENOENT if no cell DNS record can be found

Message ID 20231116155312.156593-4-dhowells@redhat.com (mailing list archive)
State New
Headers show
Series afs: Miscellaneous small fixes | expand

Commit Message

David Howells Nov. 16, 2023, 3:53 p.m. UTC
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: d5c32c89b208 ("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>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
---
 fs/afs/vl_rotate.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Marc Dionne Nov. 22, 2023, 7:04 p.m. UTC | #1
On Thu, Nov 16, 2023 at 11:53 AM David Howells <dhowells@redhat.com> wrote:
>
> 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: d5c32c89b208 ("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>
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: linux-afs@lists.infradead.org
> ---
>  fs/afs/vl_rotate.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/fs/afs/vl_rotate.c b/fs/afs/vl_rotate.c
> index 488e58490b16..eb415ce56360 100644
> --- a/fs/afs/vl_rotate.c
> +++ b/fs/afs/vl_rotate.c
> @@ -58,6 +58,12 @@ static bool afs_start_vl_iteration(struct afs_vl_cursor *vc)
>                 }
>
>                 /* 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) {
>                         vc->error = -EDESTADDRREQ;
>                         return false;
> @@ -285,6 +291,7 @@ bool afs_select_vlserver(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;
>         int i;
>
> @@ -294,6 +301,9 @@ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
>
>         rcu_read_lock();
>         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",
>                   vc->untried, vc->index, vc->nr_iterations, vc->flags, vc->error);

Reviewed-by: Marc Dionne <marc.dionne@auristor.com>

Marc
diff mbox series

Patch

diff --git a/fs/afs/vl_rotate.c b/fs/afs/vl_rotate.c
index 488e58490b16..eb415ce56360 100644
--- a/fs/afs/vl_rotate.c
+++ b/fs/afs/vl_rotate.c
@@ -58,6 +58,12 @@  static bool afs_start_vl_iteration(struct afs_vl_cursor *vc)
 		}
 
 		/* 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) {
 			vc->error = -EDESTADDRREQ;
 			return false;
@@ -285,6 +291,7 @@  bool afs_select_vlserver(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;
 	int i;
 
@@ -294,6 +301,9 @@  static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
 
 	rcu_read_lock();
 	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",
 		  vc->untried, vc->index, vc->nr_iterations, vc->flags, vc->error);