Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.com>
To: smfrench@gmail.com
Cc: linux-cifs@vger.kernel.org, Paulo Alcantara <pc@manguebit.com>
Subject: [PATCH 9/9] smb: client: propagate error from cifs_construct_tcon()
Date: Wed, 18 Sep 2024 02:15:42 -0300	[thread overview]
Message-ID: <20240918051542.64349-9-pc@manguebit.com> (raw)
In-Reply-To: <20240918051542.64349-1-pc@manguebit.com>

Propagate error from cifs_construct_tcon() in cifs_sb_tlink() instead of
always returning -EACCES.

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
---
 fs/smb/client/connect.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index e71b6933464a..5dda17ed9c77 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -4213,9 +4213,9 @@ tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink)
 struct tcon_link *
 cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
 {
-	int ret;
-	kuid_t fsuid = current_fsuid();
 	struct tcon_link *tlink, *newtlink;
+	kuid_t fsuid = current_fsuid();
+	int err;
 
 	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER))
 		return cifs_get_tlink(cifs_sb_master_tlink(cifs_sb));
@@ -4250,9 +4250,9 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
 		spin_unlock(&cifs_sb->tlink_tree_lock);
 	} else {
 wait_for_construction:
-		ret = wait_on_bit(&tlink->tl_flags, TCON_LINK_PENDING,
+		err = wait_on_bit(&tlink->tl_flags, TCON_LINK_PENDING,
 				  TASK_INTERRUPTIBLE);
-		if (ret) {
+		if (err) {
 			cifs_put_tlink(tlink);
 			return ERR_PTR(-ERESTARTSYS);
 		}
@@ -4263,8 +4263,9 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
 
 		/* return error if we tried this already recently */
 		if (time_before(jiffies, tlink->tl_time + TLINK_ERROR_EXPIRE)) {
+			err = PTR_ERR(tlink->tl_tcon);
 			cifs_put_tlink(tlink);
-			return ERR_PTR(-EACCES);
+			return ERR_PTR(err);
 		}
 
 		if (test_and_set_bit(TCON_LINK_PENDING, &tlink->tl_flags))
@@ -4276,8 +4277,9 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
 	wake_up_bit(&tlink->tl_flags, TCON_LINK_PENDING);
 
 	if (IS_ERR(tlink->tl_tcon)) {
+		err = PTR_ERR(tlink->tl_tcon);
 		cifs_put_tlink(tlink);
-		return ERR_PTR(-EACCES);
+		return ERR_PTR(err);
 	}
 
 	return tlink;
-- 
2.46.0


      parent reply	other threads:[~2024-09-18  5:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18  5:15 [PATCH 1/9] smb: client: avoid unnecessary reconnects when refreshing referrals Paulo Alcantara
2024-09-18  5:15 ` [PATCH 2/9] smb: client: improve purging of cached referrals Paulo Alcantara
2024-09-18  5:15 ` [PATCH 3/9] smb: client: fix DFS interlink failover Paulo Alcantara
2024-09-18  5:15 ` [PATCH 4/9] smb: client: stop flooding dmesg in smb2_calc_signature() Paulo Alcantara
2024-09-25  2:23   ` Steve French
2024-09-25 14:30     ` Paulo Alcantara
2024-09-18  5:15 ` [PATCH 5/9] smb: client: print failed session logoffs with FYI Paulo Alcantara
2024-09-18  5:15 ` [PATCH 6/9] smb: client: stop flooding dmesg on failed session setups Paulo Alcantara
2024-09-18  5:15 ` [PATCH 7/9] smb: client: stop flooding dmesg with automounts Paulo Alcantara
2024-09-18  5:15 ` [PATCH 8/9] smb: client: fix DFS failover in multiuser mounts Paulo Alcantara
2024-09-18  5:15 ` Paulo Alcantara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240918051542.64349-9-pc@manguebit.com \
    --to=pc@manguebit.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox