From patchwork Mon Dec 14 06:40:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bIFT4zrM; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz65CvYz9sT6 for ; Mon, 14 Dec 2020 17:42:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438786AbgLNGmR (ORCPT ); Mon, 14 Dec 2020 01:42:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28354 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438782AbgLNGmQ (ORCPT ); Mon, 14 Dec 2020 01:42:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=8lafd9RsaslFJIafxtB4tBoVDMaTxFwk3hmM3QH3MMg=; b=bIFT4zrM3IObXDiEBPF2yuBCpI8CDt1LUTzJbi2m1We6TUTVbDpay2RuG3Blxx6xRHdWnM rokekffmmylhxxZf0+IdSPOKZDc9WBmkNeQ+PZsXPkxiu/Oda0Xb3bW7BJP5SutFgJzlXt bAsY2qhc8rUuBuTW3BzT72dCa1RzYvM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-596-AKIM_X3kPBi3n3N0kJympw-1; Mon, 14 Dec 2020 01:40:47 -0500 X-MC-Unique: AKIM_X3kPBi3n3N0kJympw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA5BB18C89D9; Mon, 14 Dec 2020 06:40:46 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id C67DA60BE2; Mon, 14 Dec 2020 06:40:45 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 01/12] cifs: move cifs_cleanup_volume_info[_content] to fs_context.c Date: Mon, 14 Dec 2020 16:40:16 +1000 Message-Id: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org and rename it to smb3_cleanup_fs_context[_content] Signed-off-by: Ronnie Sahlberg --- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsproto.h | 3 --- fs/cifs/connect.c | 47 ++++------------------------------------------- fs/cifs/dfs_cache.c | 4 ++-- fs/cifs/fs_context.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- fs/cifs/fs_context.h | 2 ++ 6 files changed, 51 insertions(+), 52 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 0932a3b225be..9c2959f552e0 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -874,7 +874,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, out: if (cifs_sb) { kfree(cifs_sb->prepath); - cifs_cleanup_volume_info(cifs_sb->ctx); + smb3_cleanup_fs_context(cifs_sb->ctx); kfree(cifs_sb); } return root; diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index b80b57a66804..891c8d8c2bb5 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -237,7 +237,6 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, extern int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, struct cifs_sb_info *cifs_sb); extern int cifs_match_super(struct super_block *, void *); -extern void cifs_cleanup_volume_info(struct smb3_fs_context *ctx); extern int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx); extern void cifs_umount(struct cifs_sb_info *); extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon); @@ -552,8 +551,6 @@ extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8, extern int cifs_setup_volume_info(struct smb3_fs_context *ctx); -extern void -cifs_cleanup_volume_info_contents(struct smb3_fs_context *ctx); extern struct TCP_Server_Info * cifs_find_tcp_session(struct smb3_fs_context *ctx); diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 1c8b08c06ad7..068b13e1b499 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2806,45 +2806,6 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, return 0; } -void -cifs_cleanup_volume_info_contents(struct smb3_fs_context *ctx) -{ - if (ctx == NULL) - return; - - /* - * Make sure this stays in sync with smb3_fs_context_dup() - */ - kfree(ctx->mount_options); - ctx->mount_options = NULL; - kfree(ctx->username); - ctx->username = NULL; - kfree_sensitive(ctx->password); - ctx->password = NULL; - kfree(ctx->UNC); - ctx->UNC = NULL; - kfree(ctx->domainname); - ctx->domainname = NULL; - kfree(ctx->nodename); - ctx->nodename = NULL; - kfree(ctx->iocharset); - ctx->iocharset = NULL; - kfree(ctx->prepath); - ctx->prepath = NULL; - - unload_nls(ctx->local_nls); - ctx->local_nls = NULL; -} - -void -cifs_cleanup_volume_info(struct smb3_fs_context *ctx) -{ - if (!ctx) - return; - cifs_cleanup_volume_info_contents(ctx); - kfree(ctx); -} - /* Release all succeed connections */ static inline void mount_put_conns(struct cifs_sb_info *cifs_sb, unsigned int xid, @@ -3055,7 +3016,7 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, rc = PTR_ERR(mdata); mdata = NULL; } else { - cifs_cleanup_volume_info_contents(ctx); + smb3_cleanup_fs_context_contents(ctx); rc = cifs_setup_volume_info(ctx); } kfree(cifs_sb->ctx->mount_options); @@ -3147,7 +3108,7 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path, rc = update_vol_info(tgt_it, &fake_ctx, ctx); } } - cifs_cleanup_volume_info_contents(&fake_ctx); + smb3_cleanup_fs_context_contents(&fake_ctx); return rc; } @@ -3395,7 +3356,7 @@ static int check_dfs_prepath(struct cifs_sb_info *cifs_sb, struct smb3_fs_contex break; rc = -EREMOTE; npath = build_unc_path_to_root(&v, cifs_sb, true); - cifs_cleanup_volume_info_contents(&v); + smb3_cleanup_fs_context_contents(&v); } else { v.UNC = ctx->UNC; v.prepath = path + 1; @@ -3759,7 +3720,7 @@ static void delayed_free(struct rcu_head *p) struct cifs_sb_info *cifs_sb = container_of(p, struct cifs_sb_info, rcu); unload_nls(cifs_sb->local_nls); - cifs_cleanup_volume_info(cifs_sb->ctx); + smb3_cleanup_fs_context(cifs_sb->ctx); kfree(cifs_sb); } diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c index 6bccff4596bf..6ad6ba5f6ebe 100644 --- a/fs/cifs/dfs_cache.c +++ b/fs/cifs/dfs_cache.c @@ -587,7 +587,7 @@ static void __vol_release(struct vol_info *vi) { kfree(vi->fullpath); kfree(vi->mntdata); - cifs_cleanup_volume_info_contents(&vi->ctx); + smb3_cleanup_fs_context_contents(&vi->ctx); kfree(vi); } @@ -1468,7 +1468,7 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi, ses = cifs_get_smb_ses(server, &ctx); out: - cifs_cleanup_volume_info_contents(&ctx); + smb3_cleanup_fs_context_contents(&ctx); kfree(mdata); kfree(rpath); diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index fe5cc60f4393..4739caa0af97 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -289,7 +289,7 @@ do { \ if (ctx->field) { \ new_ctx->field = kstrdup(ctx->field, GFP_ATOMIC); \ if (new_ctx->field == NULL) { \ - cifs_cleanup_volume_info_contents(new_ctx); \ + smb3_cleanup_fs_context_contents(new_ctx); \ return -ENOMEM; \ } \ } \ @@ -312,7 +312,7 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx new_ctx->iocharset = NULL; /* - * Make sure to stay in sync with cifs_cleanup_volume_info_contents() + * Make sure to stay in sync with smb3_cleanup_fs_context_contents() */ DUP_CTX_STR(prepath); DUP_CTX_STR(mount_options); @@ -617,7 +617,7 @@ static void smb3_fs_context_free(struct fs_context *fc) { struct smb3_fs_context *ctx = smb3_fc2context(fc); - cifs_cleanup_volume_info(ctx); + smb3_cleanup_fs_context(ctx); } static int smb3_reconfigure(struct fs_context *fc) @@ -1243,3 +1243,42 @@ int smb3_init_fs_context(struct fs_context *fc) fc->ops = &smb3_fs_context_ops; return 0; } + +void +smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx) +{ + if (ctx == NULL) + return; + + /* + * Make sure this stays in sync with smb3_fs_context_dup() + */ + kfree(ctx->mount_options); + ctx->mount_options = NULL; + kfree(ctx->username); + ctx->username = NULL; + kfree_sensitive(ctx->password); + ctx->password = NULL; + kfree(ctx->UNC); + ctx->UNC = NULL; + kfree(ctx->domainname); + ctx->domainname = NULL; + kfree(ctx->nodename); + ctx->nodename = NULL; + kfree(ctx->iocharset); + ctx->iocharset = NULL; + kfree(ctx->prepath); + ctx->prepath = NULL; + + unload_nls(ctx->local_nls); + ctx->local_nls = NULL; +} + +void +smb3_cleanup_fs_context(struct smb3_fs_context *ctx) +{ + if (!ctx) + return; + smb3_cleanup_fs_context_contents(ctx); + kfree(ctx); +} diff --git a/fs/cifs/fs_context.h b/fs/cifs/fs_context.h index aaec8a819d34..4c4c392b9767 100644 --- a/fs/cifs/fs_context.h +++ b/fs/cifs/fs_context.h @@ -254,6 +254,8 @@ extern int cifs_parse_cache_flavor(char *value, extern int cifs_parse_security_flavors(char *value, struct smb3_fs_context *ctx); extern int smb3_init_fs_context(struct fs_context *fc); +extern void smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx); +extern void smb3_cleanup_fs_context(struct smb3_fs_context *ctx); static inline struct smb3_fs_context *smb3_fc2context(const struct fs_context *fc) { From patchwork Mon Dec 14 06:40:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415814 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EltWQU50; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz52gkPz9sT6 for ; Mon, 14 Dec 2020 17:42:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438783AbgLNGmJ (ORCPT ); Mon, 14 Dec 2020 01:42:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34260 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbgLNGmI (ORCPT ); Mon, 14 Dec 2020 01:42:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=O8+f8t+EttNDsCr3GtWhJkkS1qfL/xbbqBz3QJZTn9o=; b=EltWQU50R6+gzOeABcCXmc5BLDvOwpZSsCfBAsTPhLreOnO5EiBx+KCwuDSssfPr4mZMCL 4iW2YjmoprXihC91TFDE5VZH9RNquShrW9Iq3MlOMFP3112suA5+8DGGiOObIoIDYGylMD +ksgff9n1WFWZmjm6S24XEzirJugrEE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-VlhqTXT6NZCltbm2FMts0Q-1; Mon, 14 Dec 2020 01:40:38 -0500 X-MC-Unique: VlhqTXT6NZCltbm2FMts0Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D146759; Mon, 14 Dec 2020 06:40:37 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id D184C60BE2; Mon, 14 Dec 2020 06:40:36 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 02/12] cifs: move [brw]size from cifs_sb to cifs_sb->ctx Date: Mon, 14 Dec 2020 16:40:17 +1000 Message-Id: <20201214064027.2885-2-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Ronnie Sahlberg --- fs/cifs/cifs_fs_sb.h | 3 --- fs/cifs/cifsfs.c | 11 +++++++---- fs/cifs/connect.c | 21 +++++++++------------ fs/cifs/file.c | 12 ++++++------ fs/cifs/fs_context.c | 3 +++ fs/cifs/fs_context.h | 3 +++ fs/cifs/inode.c | 2 +- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2ops.c | 2 +- 9 files changed, 31 insertions(+), 28 deletions(-) diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index 69d26313d350..aa77edc12212 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h @@ -62,9 +62,6 @@ struct cifs_sb_info { struct tcon_link *master_tlink; struct nls_table *local_nls; struct smb3_fs_context *ctx; - unsigned int bsize; - unsigned int rsize; - unsigned int wsize; atomic_t active; unsigned int mnt_cifs_flags; struct delayed_work prune_tlinks; diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 9c2959f552e0..6a3cb192d75a 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -218,7 +218,7 @@ cifs_read_super(struct super_block *sb) if (rc) goto out_no_root; /* tune readahead according to rsize */ - sb->s_bdi->ra_pages = cifs_sb->rsize / PAGE_SIZE; + sb->s_bdi->ra_pages = cifs_sb->ctx->rsize / PAGE_SIZE; sb->s_blocksize = CIFS_MAX_MSGSIZE; sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */ @@ -615,9 +615,12 @@ cifs_show_options(struct seq_file *s, struct dentry *root) from_kgid_munged(&init_user_ns, cifs_sb->ctx->backupgid)); - seq_printf(s, ",rsize=%u", cifs_sb->rsize); - seq_printf(s, ",wsize=%u", cifs_sb->wsize); - seq_printf(s, ",bsize=%u", cifs_sb->bsize); + if (cifs_sb->ctx->got_rsize) + seq_printf(s, ",rsize=%u", cifs_sb->ctx->rsize); + if (cifs_sb->ctx->got_wsize) + seq_printf(s, ",wsize=%u", cifs_sb->ctx->wsize); + if (cifs_sb->ctx->got_bsize) + seq_printf(s, ",bsize=%u", cifs_sb->ctx->bsize); if (tcon->ses->server->min_offload) seq_printf(s, ",esize=%u", tcon->ses->server->min_offload); seq_printf(s, ",echo_interval=%lu", diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 068b13e1b499..ceb660e1b601 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2234,10 +2234,10 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) * We want to share sb only if we don't specify an r/wsize or * specified r/wsize is greater than or equal to existing one. */ - if (new->wsize && new->wsize < old->wsize) + if (new->ctx->wsize && new->ctx->wsize < old->ctx->wsize) return 0; - if (new->rsize && new->rsize < old->rsize) + if (new->ctx->rsize && new->ctx->rsize < old->ctx->rsize) return 0; if (!uid_eq(old->ctx->linux_uid, new->ctx->linux_uid) || @@ -2700,14 +2700,6 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, spin_lock_init(&cifs_sb->tlink_tree_lock); cifs_sb->tlink_tree = RB_ROOT; - cifs_sb->bsize = ctx->bsize; - /* - * Temporarily set r/wsize for matching superblock. If we end up using - * new sb then client will later negotiate it downward if needed. - */ - cifs_sb->rsize = ctx->rsize; - cifs_sb->wsize = ctx->wsize; - cifs_dbg(FYI, "file mode: %04ho dir mode: %04ho\n", cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); @@ -2911,8 +2903,13 @@ static int mount_get_conns(struct smb3_fs_context *ctx, struct cifs_sb_info *cif } } - cifs_sb->wsize = server->ops->negotiate_wsize(tcon, ctx); - cifs_sb->rsize = server->ops->negotiate_rsize(tcon, ctx); + /* + * Clamp the rsize/wsize mount arguments if they are too big for the server + */ + if (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx)) + cifs_sb->ctx->wsize = server->ops->negotiate_wsize(tcon, ctx); + if (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx)) + cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); return 0; } diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 583074546e6f..6d001905c8e5 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2336,7 +2336,7 @@ static int cifs_writepages(struct address_space *mapping, * If wsize is smaller than the page cache size, default to writing * one page at a time via cifs_writepage */ - if (cifs_sb->wsize < PAGE_SIZE) + if (cifs_sb->ctx->wsize < PAGE_SIZE) return generic_writepages(mapping, wbc); xid = get_xid(); @@ -2369,7 +2369,7 @@ static int cifs_writepages(struct address_space *mapping, if (rc) get_file_rc = rc; - rc = server->ops->wait_mtu_credits(server, cifs_sb->wsize, + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->wsize, &wsize, credits); if (rc != 0) { done = true; @@ -2911,7 +2911,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, break; } - rc = server->ops->wait_mtu_credits(server, cifs_sb->wsize, + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->wsize, &wsize, credits); if (rc) break; @@ -3642,7 +3642,7 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file, break; } - rc = server->ops->wait_mtu_credits(server, cifs_sb->rsize, + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, credits); if (rc) break; @@ -4028,7 +4028,7 @@ cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset) cifs_sb = CIFS_FILE_SB(file); /* FIXME: set up handlers for larger reads and/or convert to async */ - rsize = min_t(unsigned int, cifs_sb->rsize, CIFSMaxBufSize); + rsize = min_t(unsigned int, cifs_sb->ctx->rsize, CIFSMaxBufSize); if (file->private_data == NULL) { rc = -EBADF; @@ -4413,7 +4413,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, break; } - rc = server->ops->wait_mtu_credits(server, cifs_sb->rsize, + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, credits); if (rc) break; diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index 4739caa0af97..e83bd4382dfa 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -783,12 +783,15 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, goto cifs_parse_mount_err; } ctx->bsize = result.uint_32; + ctx->got_bsize = true; break; case Opt_rsize: ctx->rsize = result.uint_32; + ctx->got_rsize = true; break; case Opt_wsize: ctx->wsize = result.uint_32; + ctx->got_wsize = true; break; case Opt_actimeo: ctx->actimeo = HZ * result.uint_32; diff --git a/fs/cifs/fs_context.h b/fs/cifs/fs_context.h index 4c4c392b9767..7c794df7a874 100644 --- a/fs/cifs/fs_context.h +++ b/fs/cifs/fs_context.h @@ -152,6 +152,9 @@ struct smb3_fs_context { char *nodename; bool got_ip; bool got_version; + bool got_rsize; + bool got_wsize; + bool got_bsize; unsigned short port; char *username; diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 240d79e3aa14..a83b3a8ffaac 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2409,7 +2409,7 @@ int cifs_getattr(const struct path *path, struct kstat *stat, } generic_fillattr(inode, stat); - stat->blksize = cifs_sb->bsize; + stat->blksize = cifs_sb->ctx->bsize; stat->ino = CIFS_I(inode)->uniqueid; /* old CIFS Unix Extensions doesn't return create time */ diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 359a0ef796de..e31b939e628c 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -1006,7 +1006,7 @@ cifs_is_read_op(__u32 oplock) static unsigned int cifs_wp_retry_size(struct inode *inode) { - return CIFS_SB(inode->i_sb)->wsize; + return CIFS_SB(inode->i_sb)->ctx->wsize; } static bool diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 940e61e92a8c..a505cc3e58da 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3951,7 +3951,7 @@ smb3_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key) static unsigned int smb2_wp_retry_size(struct inode *inode) { - return min_t(unsigned int, CIFS_SB(inode->i_sb)->wsize, + return min_t(unsigned int, CIFS_SB(inode->i_sb)->ctx->wsize, SMB2_MAX_BUFFER_SIZE); } From patchwork Mon Dec 14 06:40:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KrLnvzep; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz73vb0z9sTK for ; Mon, 14 Dec 2020 17:42:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438782AbgLNGmV (ORCPT ); Mon, 14 Dec 2020 01:42:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23032 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438787AbgLNGmV (ORCPT ); Mon, 14 Dec 2020 01:42:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=dk9WPLSfZuxNoqUUxSGx5+IDenWtY5agN6HgZSFH/kQ=; b=KrLnvzepCdqzgT1cZ9FkbD9TOXYd2+wbJ+EYbM3V12jW9wm+c8vdW03Ew18i+64TZrDuAH d+CDKyx6VzeLyg6CLyOp2+aX52g/+cGxep/GlNqN7asnIvdvQ1qAETE9JRJDiw1xTnuJm+ b4P2ZzkMtua3TZqi++lhW6bEu78fllU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-VzuQA7JcOtGHW7mM-8yNtg-1; Mon, 14 Dec 2020 01:40:53 -0500 X-MC-Unique: VzuQA7JcOtGHW7mM-8yNtg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 603C1107ACE8; Mon, 14 Dec 2020 06:40:52 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E9A66E71E; Mon, 14 Dec 2020 06:40:51 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 03/12] cifs: add initial reconfigure support Date: Mon, 14 Dec 2020 16:40:18 +1000 Message-Id: <20201214064027.2885-3-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Ronnie Sahlberg --- fs/cifs/fs_context.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index e83bd4382dfa..4bab06f97727 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -620,14 +620,44 @@ static void smb3_fs_context_free(struct fs_context *fc) smb3_cleanup_fs_context(ctx); } -static int smb3_reconfigure(struct fs_context *fc) +/* + * Compare the old and new proposed context during reconfigure + * and check if the changes are compatible. + */ +static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx, + struct smb3_fs_context *old_ctx) { - // TODO: struct smb3_fs_context *ctx = smb3_fc2context(fc); + if (new_ctx->sectype != old_ctx->sectype) { + cifs_dbg(VFS, "can not change sec during remount\n"); + return -EINVAL; + } - /* FIXME : add actual reconfigure */ return 0; } +static int smb3_reconfigure(struct fs_context *fc) +{ + struct smb3_fs_context *ctx = smb3_fc2context(fc); + struct dentry *root = fc->root; + struct cifs_sb_info *cifs_sb = CIFS_SB(root->d_sb); + int rc; + + rc = smb3_verify_reconfigure_ctx(ctx, cifs_sb->ctx); + if (rc) + return rc; + + /* + * Steal the UNC from the old and to be destroyed context. + */ + ctx->UNC = cifs_sb->ctx->UNC; + cifs_sb->ctx->UNC = NULL; + + smb3_cleanup_fs_context_contents(cifs_sb->ctx); + rc = smb3_fs_context_dup(cifs_sb->ctx, ctx); + + return rc; +} + static int smb3_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param) { From patchwork Mon Dec 14 06:40:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=U8kl/jyF; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz76YPvz9sSf for ; Mon, 14 Dec 2020 17:42:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438792AbgLNGm0 (ORCPT ); Mon, 14 Dec 2020 01:42:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24401 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438787AbgLNGmZ (ORCPT ); Mon, 14 Dec 2020 01:42:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=u6myNMBXxw2VPmGkAp08G/VSdolxg61CaXwfh1eR5xQ=; b=U8kl/jyFm1zPM9iQvIo+KFr8ieutjX9xLKbSKgb1RD5xg3SSxix+Izaa59Gt1e4lEdKhrJ yToKgvpnp1WPcv6OOELb+QsRQ3awBqHihOHtwuKIqLV8AE1bQ0mG7K8J99Hivzyn8Tfz3J JGijeMVCOpe9ZCvM7F7aK/D/uC1tVOw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451--1VjGKN2NCC4nVVSzC7c0Q-1; Mon, 14 Dec 2020 01:40:56 -0500 X-MC-Unique: -1VjGKN2NCC4nVVSzC7c0Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB0218015C4; Mon, 14 Dec 2020 06:40:54 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A6A857; Mon, 14 Dec 2020 06:40:53 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 04/12] cifs: we do not allow changing username/password/unc/... during remount Date: Mon, 14 Dec 2020 16:40:19 +1000 Message-Id: <20201214064027.2885-4-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Ronnie Sahlberg --- fs/cifs/cifsfs.c | 2 +- fs/cifs/fs_context.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--- fs/cifs/fs_context.h | 2 +- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 6a3cb192d75a..276b0659c238 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -493,7 +493,7 @@ cifs_show_options(struct seq_file *s, struct dentry *root) if (tcon->no_lease) seq_puts(s, ",nolease"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) + if (cifs_sb->ctx->multiuser) seq_puts(s, ",multiuser"); else if (tcon->ses->user_name) seq_show_option(s, "username", tcon->ses->user_name); diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index 4bab06f97727..d312d4bac3d1 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -631,10 +631,51 @@ static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx, cifs_dbg(VFS, "can not change sec during remount\n"); return -EINVAL; } + if (new_ctx->multiuser != old_ctx->multiuser) { + cifs_dbg(VFS, "can not change multiuser during remount\n"); + return -EINVAL; + } + if (new_ctx->UNC && + (!old_ctx->UNC || strcmp(new_ctx->UNC, old_ctx->UNC))) { + cifs_dbg(VFS, "can not change UNC during remount\n"); + return -EINVAL; + } + if (new_ctx->username && + (!old_ctx->username || strcmp(new_ctx->username, old_ctx->username))) { + cifs_dbg(VFS, "can not change username during remount\n"); + return -EINVAL; + } + if (new_ctx->password && + (!old_ctx->password || strcmp(new_ctx->password, old_ctx->password))) { + cifs_dbg(VFS, "can not change password during remount\n"); + return -EINVAL; + } + if (new_ctx->domainname && + (!old_ctx->domainname || strcmp(new_ctx->domainname, old_ctx->domainname))) { + cifs_dbg(VFS, "can not change domainname during remount\n"); + return -EINVAL; + } + if (new_ctx->nodename && + (!old_ctx->nodename || strcmp(new_ctx->nodename, old_ctx->nodename))) { + cifs_dbg(VFS, "can not change nodename during remount\n"); + return -EINVAL; + } + if (new_ctx->iocharset && + (!old_ctx->iocharset || strcmp(new_ctx->iocharset, old_ctx->iocharset))) { + cifs_dbg(VFS, "can not change iocharset during remount\n"); + return -EINVAL; + } return 0; } +#define STEAL_STRING(cifs_sb, ctx, field) \ +do { \ + kfree(ctx->field); \ + ctx->field = cifs_sb->ctx->field; \ + cifs_sb->ctx->field = NULL; \ +} while (0) + static int smb3_reconfigure(struct fs_context *fc) { struct smb3_fs_context *ctx = smb3_fc2context(fc); @@ -647,10 +688,16 @@ static int smb3_reconfigure(struct fs_context *fc) return rc; /* - * Steal the UNC from the old and to be destroyed context. + * We can not change UNC/username/password/domainname/nodename/iocharset + * during reconnect so ignore what we have in the new context and + * just use what we already have in cifs_sb->ctx. */ - ctx->UNC = cifs_sb->ctx->UNC; - cifs_sb->ctx->UNC = NULL; + STEAL_STRING(cifs_sb, ctx, UNC); + STEAL_STRING(cifs_sb, ctx, username); + STEAL_STRING(cifs_sb, ctx, password); + STEAL_STRING(cifs_sb, ctx, domainname); + STEAL_STRING(cifs_sb, ctx, nodename); + STEAL_STRING(cifs_sb, ctx, iocharset); smb3_cleanup_fs_context_contents(cifs_sb->ctx); rc = smb3_fs_context_dup(cifs_sb->ctx, ctx); diff --git a/fs/cifs/fs_context.h b/fs/cifs/fs_context.h index 7c794df7a874..1680d0ceed38 100644 --- a/fs/cifs/fs_context.h +++ b/fs/cifs/fs_context.h @@ -149,7 +149,6 @@ struct smb3_fs_context { bool uid_specified; bool gid_specified; bool sloppy; - char *nodename; bool got_ip; bool got_version; bool got_rsize; @@ -161,6 +160,7 @@ struct smb3_fs_context { char *password; char *domainname; char *UNC; + char *nodename; char *iocharset; /* local code page for mapping to and from Unicode */ char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */ char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */ From patchwork Mon Dec 14 06:40:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HC42xxeG; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz62Lk2z9sSf for ; Mon, 14 Dec 2020 17:42:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438784AbgLNGmN (ORCPT ); Mon, 14 Dec 2020 01:42:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52420 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438782AbgLNGmN (ORCPT ); Mon, 14 Dec 2020 01:42:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=abxOg153gr0wim2pd1T0tjwbT+hXCaGltQd5b+RbZ1o=; b=HC42xxeGpHrHmKuefsTYd0JlGGD1XhFtqMo69C9khKUvMihAOoDjt9TF2wmuQaNLzeB1mx BaYSwOSe9oZ+RhHYKE2izoUwrgbYDjS+OBqI1ejyhtvVIST+JDHUAQXu/a2SnfiamNAYR2 3vldggk6ikET+3TcoPW0jZqwajJPM+Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-576-AvLHMZSeMEqCj5zBoC5O-w-1; Mon, 14 Dec 2020 01:40:44 -0500 X-MC-Unique: AvLHMZSeMEqCj5zBoC5O-w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7750F801817; Mon, 14 Dec 2020 06:40:43 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84DEB7086A; Mon, 14 Dec 2020 06:40:42 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 05/12] cifs: simplify handling of cifs_sb/ctx->local_nls Date: Mon, 14 Dec 2020 16:40:20 +1000 Message-Id: <20201214064027.2885-5-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Only load/unload local_nls from cifs_sb and just make the ctx contain a pointer to cifs_sb->ctx. Signed-off-by: Ronnie Sahlberg --- fs/cifs/cifsproto.h | 4 +--- fs/cifs/connect.c | 29 ++++++++++++++--------------- fs/cifs/fs_context.c | 4 ---- fs/cifs/fs_context.h | 2 +- fs/cifs/sess.c | 23 +++++++++++------------ 5 files changed, 27 insertions(+), 35 deletions(-) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 891c8d8c2bb5..313d252bbbe9 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -598,9 +598,7 @@ extern void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page, unsigned int *len, unsigned int *offset); struct cifs_chan * cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server); -int cifs_try_adding_channels(struct cifs_ses *ses); -int cifs_ses_add_channel(struct cifs_ses *ses, - struct cifs_server_iface *iface); +int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses); bool is_server_using_iface(struct TCP_Server_Info *server, struct cifs_server_iface *iface); bool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface); diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index ceb660e1b601..62daed702e51 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2703,7 +2703,19 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, cifs_dbg(FYI, "file mode: %04ho dir mode: %04ho\n", cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); - cifs_sb->local_nls = ctx->local_nls; + /* this is needed for ASCII cp to Unicode converts */ + if (ctx->iocharset == NULL) { + /* load_nls_default cannot return null */ + cifs_sb->local_nls = load_nls_default(); + } else { + cifs_sb->local_nls = load_nls(ctx->iocharset); + if (cifs_sb->local_nls == NULL) { + cifs_dbg(VFS, "CIFS mount error: iocharset %s not found\n", + ctx->iocharset); + return -ELIBACC; + } + } + ctx->local_nls = cifs_sb->local_nls; if (ctx->nodfs) cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_DFS; @@ -3173,19 +3185,6 @@ cifs_setup_volume_info(struct smb3_fs_context *ctx) return -EINVAL; } - /* this is needed for ASCII cp to Unicode converts */ - if (ctx->iocharset == NULL) { - /* load_nls_default cannot return null */ - ctx->local_nls = load_nls_default(); - } else { - ctx->local_nls = load_nls(ctx->iocharset); - if (ctx->local_nls == NULL) { - cifs_dbg(VFS, "CIFS mount error: iocharset %s not found\n", - ctx->iocharset); - return -ELIBACC; - } - } - return rc; } @@ -3507,7 +3506,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) out: free_xid(xid); - cifs_try_adding_channels(ses); + cifs_try_adding_channels(cifs_sb, ses); return mount_setup_tlink(cifs_sb, ses, tcon); error: diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index d312d4bac3d1..40a5cfe0615b 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -303,7 +303,6 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx memcpy(new_ctx, ctx, sizeof(*ctx)); new_ctx->prepath = NULL; new_ctx->mount_options = NULL; - new_ctx->local_nls = NULL; new_ctx->nodename = NULL; new_ctx->username = NULL; new_ctx->password = NULL; @@ -1349,9 +1348,6 @@ smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx) ctx->iocharset = NULL; kfree(ctx->prepath); ctx->prepath = NULL; - - unload_nls(ctx->local_nls); - ctx->local_nls = NULL; } void diff --git a/fs/cifs/fs_context.h b/fs/cifs/fs_context.h index 1680d0ceed38..2519108eeb29 100644 --- a/fs/cifs/fs_context.h +++ b/fs/cifs/fs_context.h @@ -237,7 +237,7 @@ struct smb3_fs_context { char *prepath; struct sockaddr_storage dstaddr; /* destination address */ struct sockaddr_storage srcaddr; /* allow binding to a local IP */ - struct nls_table *local_nls; + struct nls_table *local_nls; /* This is a copy of the pointer in cifs_sb */ unsigned int echo_interval; /* echo interval in secs */ __u64 snapshot_time; /* needed for timewarp tokens */ __u32 handle_timeout; /* persistent and durable handle timeout in ms */ diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 00ca687a17dd..213465718fa8 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -34,6 +34,10 @@ #include "smb2proto.h" #include "fs_context.h" +static int +cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses, + struct cifs_server_iface *iface); + bool is_server_using_iface(struct TCP_Server_Info *server, struct cifs_server_iface *iface) @@ -71,7 +75,7 @@ bool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface) } /* returns number of channels added */ -int cifs_try_adding_channels(struct cifs_ses *ses) +int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) { int old_chan_count = ses->chan_count; int left = ses->chan_max - ses->chan_count; @@ -134,7 +138,7 @@ int cifs_try_adding_channels(struct cifs_ses *ses) continue; } - rc = cifs_ses_add_channel(ses, iface); + rc = cifs_ses_add_channel(cifs_sb, ses, iface); if (rc) { cifs_dbg(FYI, "failed to open extra channel on iface#%d rc=%d\n", i, rc); @@ -167,8 +171,9 @@ cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server) return NULL; } -int -cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface) +static int +cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses, + struct cifs_server_iface *iface) { struct cifs_chan *chan; struct smb3_fs_context ctx = {NULL}; @@ -229,13 +234,8 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface) /* * This will be used for encoding/decoding user/domain/pw * during sess setup auth. - * - * XXX: We use the default for simplicity but the proper way - * would be to use the one that ses used, which is not - * stored. This might break when dealing with non-ascii - * strings. */ - ctx.local_nls = load_nls_default(); + ctx.local_nls = cifs_sb->local_nls; /* Use RDMA if possible */ ctx.rdma = iface->rdma_capable; @@ -275,7 +275,7 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface) if (rc) goto out; - rc = cifs_setup_session(xid, ses, ctx.local_nls); + rc = cifs_setup_session(xid, ses, cifs_sb->local_nls); if (rc) goto out; @@ -298,7 +298,6 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface) if (rc && chan->server) cifs_put_tcp_session(chan->server, 0); - unload_nls(ctx.local_nls); return rc; } From patchwork Mon Dec 14 06:40:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FQSe/asU; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz96Pypz9sSf for ; Mon, 14 Dec 2020 17:42:29 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438795AbgLNGm3 (ORCPT ); Mon, 14 Dec 2020 01:42:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55315 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438787AbgLNGm3 (ORCPT ); Mon, 14 Dec 2020 01:42:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=9Na4ezo+0yInqb6WnNQqxr1kCibF77BUZS3DKApPnBw=; b=FQSe/asUUL9zHyG7IgCitObzFb5MTOTZUrbfb+LHqkDJBuAr15NqYsT/R9s+XKZOW2jYG7 68OagyYENS8Qgjz0F5vXaFjzF7iOyRxwYIgloapPPEfoW9Pg9C3AuzHemp4j5FZFO3tuSj gu4O09aqfgjPGgRkMr4CH3L7FQZvSfo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-237-qj9LNeIGOj26n21j-gIUVA-1; Mon, 14 Dec 2020 01:41:01 -0500 X-MC-Unique: qj9LNeIGOj26n21j-gIUVA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59B72809DC3; Mon, 14 Dec 2020 06:41:00 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF7D65D9D0; Mon, 14 Dec 2020 06:40:59 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 06/12] cifs: don't create a temp nls in cifs_setup_ipc Date: Mon, 14 Dec 2020 16:40:21 +1000 Message-Id: <20201214064027.2885-6-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org just use the one that is already available in ctx Signed-off-by: Ronnie Sahlberg --- fs/cifs/connect.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 62daed702e51..926a8b310366 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1464,7 +1464,6 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) { int rc = 0, xid; struct cifs_tcon *tcon; - struct nls_table *nls_codepage; char unc[SERVER_NAME_LENGTH + sizeof("//x/IPC$")] = {0}; bool seal = false; struct TCP_Server_Info *server = ses->server; @@ -1489,14 +1488,11 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) scnprintf(unc, sizeof(unc), "\\\\%s\\IPC$", server->hostname); - /* cannot fail */ - nls_codepage = load_nls_default(); - xid = get_xid(); tcon->ses = ses; tcon->ipc = true; tcon->seal = seal; - rc = server->ops->tree_connect(xid, ses, unc, tcon, nls_codepage); + rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls); free_xid(xid); if (rc) { @@ -1509,7 +1505,6 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) ses->tcon_ipc = tcon; out: - unload_nls(nls_codepage); return rc; } From patchwork Mon Dec 14 06:40:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OuFeHC91; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz71Hl5z9sSf for ; Mon, 14 Dec 2020 17:42:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438788AbgLNGmV (ORCPT ); Mon, 14 Dec 2020 01:42:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40898 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438782AbgLNGmU (ORCPT ); Mon, 14 Dec 2020 01:42:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=6c1wZGRFleIGfB616jwlOkmmA1TncgI+I0JERE4mVTA=; b=OuFeHC91/8axkQoIN5OF/omZ5BwseYIoc5xFDDzGajQcEgLVLISD0kRJr6TDm1U7F0JeKT Bt465wA4uAzL7mfHX8WW7HJU4o0c3fV9Dpl4/BRAH/5I/7PJMFk4jgN4DAI0lunKiBIYYB x59hVX3KlpVFnTvvhTIgl3enVa7MLxQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-223-PfCu4FyMNZCtSekST6Y98A-1; Mon, 14 Dec 2020 01:40:50 -0500 X-MC-Unique: PfCu4FyMNZCtSekST6Y98A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 36A7359; Mon, 14 Dec 2020 06:40:49 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F72B10023AD; Mon, 14 Dec 2020 06:40:48 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 07/12] cifs: uncomplicate printing the iocharset parameter Date: Mon, 14 Dec 2020 16:40:22 +1000 Message-Id: <20201214064027.2885-7-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org There is no need to load the default nls to check if the iocharset argument was specified or not since we have it in cifs_sb->ctx Signed-off-by: Ronnie Sahlberg --- fs/cifs/cifsfs.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 276b0659c238..229e5cbcaf18 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -462,18 +462,6 @@ cifs_show_cache_flavor(struct seq_file *s, struct cifs_sb_info *cifs_sb) seq_puts(s, "loose"); } -static void -cifs_show_nls(struct seq_file *s, struct nls_table *cur) -{ - struct nls_table *def; - - /* Display iocharset= option if it's not default charset */ - def = load_nls_default(); - if (def != cur) - seq_printf(s, ",iocharset=%s", cur->charset); - unload_nls(def); -} - /* * cifs_show_options() is for displaying mount options in /proc/mounts. * Not all settable options are displayed but most of the important @@ -537,9 +525,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",file_mode=0%ho,dir_mode=0%ho", cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); - - cifs_show_nls(s, cifs_sb->local_nls); - + if (cifs_sb->ctx->iocharset) + seq_printf(s, ",iocharset=%s", cifs_sb->ctx->iocharset); if (tcon->seal) seq_puts(s, ",seal"); else if (tcon->ses->server->ignore_signature) From patchwork Mon Dec 14 06:40:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RZzE7yHe; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz56mcJz9sTK for ; Mon, 14 Dec 2020 17:42:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728023AbgLNGmJ (ORCPT ); Mon, 14 Dec 2020 01:42:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21338 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438782AbgLNGmJ (ORCPT ); Mon, 14 Dec 2020 01:42:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=Q2EbUnmYufQyRNu8arCrSK+lGVrZXidyDAaFQFTdD3I=; b=RZzE7yHe+puW6Rr97t3nico2cIyOTFCksXmbcRmoZdLOV5YVPU/RSuPbD+ugUYiX1G8gR7 x7g8z7DqKHBY3TVWCvTzKUbeKGOQSErpI7hCvpSX5Q2J+fJmsX7hkl3DLsLu4Nkm7qbTBD 0g35kBEBxg8b26iMTQFTrsIp5E9VcQA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-JYAbWmw1Odyl7_rCDoNGHQ-1; Mon, 14 Dec 2020 01:40:41 -0500 X-MC-Unique: JYAbWmw1Odyl7_rCDoNGHQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B4B25809DC3; Mon, 14 Dec 2020 06:40:40 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DFA660C05; Mon, 14 Dec 2020 06:40:39 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 08/12] cifs: do not allow changing posix_paths during remount Date: Mon, 14 Dec 2020 16:40:23 +1000 Message-Id: <20201214064027.2885-8-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Ronnie Sahlberg --- fs/cifs/fs_context.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index 40a5cfe0615b..4995082b7285 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -626,6 +626,10 @@ static void smb3_fs_context_free(struct fs_context *fc) static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx, struct smb3_fs_context *old_ctx) { + if (new_ctx->posix_paths != old_ctx->posix_paths) { + cifs_dbg(VFS, "can not change posixpaths during remount\n"); + return -EINVAL; + } if (new_ctx->sectype != old_ctx->sectype) { cifs_dbg(VFS, "can not change sec during remount\n"); return -EINVAL; From patchwork Mon Dec 14 06:40:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415823 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dknaR4YS; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWzG75XNz9sSf for ; Mon, 14 Dec 2020 17:42:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438796AbgLNGme (ORCPT ); Mon, 14 Dec 2020 01:42:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45409 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438787AbgLNGme (ORCPT ); Mon, 14 Dec 2020 01:42:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=ch/jhKjSqYX7AO2lNuKAFGOqKMWHiYGbkt6KpTwgo8w=; b=dknaR4YSn0N50Oj3nkLodrEGVB/T8AEMC2SqY+Os17tVXVNQRMsujUj0zWKRFtuUU8zGF4 13mNvBogGuzhToxshf9E2ISTQYtFjrTMThNGdMRtg0adHQAXnEmFoq5RlxcUEVqGpZaeG1 IJafjh+2C3bvS8JhDVIMfIXUZfWbwME= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-uMzRInynPd-TcBc0tWn55Q-1; Mon, 14 Dec 2020 01:41:04 -0500 X-MC-Unique: uMzRInynPd-TcBc0tWn55Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB667A0CA0; Mon, 14 Dec 2020 06:41:03 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9E9A28557; Mon, 14 Dec 2020 06:41:02 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 09/12] cifs: remove ctx argument from cifs_setup_cifs_sb Date: Mon, 14 Dec 2020 16:40:24 +1000 Message-Id: <20201214064027.2885-9-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Ronnie Sahlberg --- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsproto.h | 3 +-- fs/cifs/connect.c | 7 ++++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 229e5cbcaf18..4c385eeecc05 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -810,7 +810,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, goto out; } - rc = cifs_setup_cifs_sb(cifs_sb->ctx, cifs_sb); + rc = cifs_setup_cifs_sb(cifs_sb); if (rc) { root = ERR_PTR(rc); goto out; diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 313d252bbbe9..bd1c9b038568 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -234,8 +234,7 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, unsigned int page_offset, unsigned int to_read); -extern int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, - struct cifs_sb_info *cifs_sb); +extern int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb); extern int cifs_match_super(struct super_block *, void *); extern int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx); extern void cifs_umount(struct cifs_sb_info *); diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 926a8b310366..606f36322c60 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2687,16 +2687,17 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, } } -int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, - struct cifs_sb_info *cifs_sb) +int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb) { + struct smb3_fs_context *ctx = cifs_sb->ctx; + INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); spin_lock_init(&cifs_sb->tlink_tree_lock); cifs_sb->tlink_tree = RB_ROOT; cifs_dbg(FYI, "file mode: %04ho dir mode: %04ho\n", - cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); + ctx->file_mode, ctx->dir_mode); /* this is needed for ASCII cp to Unicode converts */ if (ctx->iocharset == NULL) { From patchwork Mon Dec 14 06:40:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415824 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gVKGlF/C; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWzL1rfqz9sSf for ; Mon, 14 Dec 2020 17:42:38 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438797AbgLNGmh (ORCPT ); Mon, 14 Dec 2020 01:42:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37299 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438787AbgLNGmh (ORCPT ); Mon, 14 Dec 2020 01:42:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=ZXUx85e9fdKtKvSHRNkblw9ZiVahNJOQtDu/cvZz/OE=; b=gVKGlF/Cryjp+zzzCdlrxks3sC5Xh621lxgczRze+sgazqTXDm9AmTeMpHY2m1SYLUfa9z ITxfBB5I8wEKbbdphYB2ERs6hujYmcY2d2CVwLqUmJEDUbSvK9wR5j6F6Ik0C31ey8s5u4 JTMvObgU+190rWJS8dfzi8wGbfjjXSo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-521-wKj6gmWjMG6l-vgHgFYoOg-1; Mon, 14 Dec 2020 01:41:07 -0500 X-MC-Unique: wKj6gmWjMG6l-vgHgFYoOg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 68B531006C81; Mon, 14 Dec 2020 06:41:06 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E5CF10023BC; Mon, 14 Dec 2020 06:41:05 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 10/12] cifs: move update of flags into a separate function Date: Mon, 14 Dec 2020 16:40:25 +1000 Message-Id: <20201214064027.2885-10-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org This funciton will set/clear flags that can be changed during mount or remount Signed-off-by: Ronnie Sahlberg --- fs/cifs/connect.c | 74 +----------------------- fs/cifs/fs_context.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/cifs/fs_context.h | 1 + 3 files changed, 159 insertions(+), 71 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 606f36322c60..592cc6e365af 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2713,61 +2713,10 @@ int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb) } ctx->local_nls = cifs_sb->local_nls; - if (ctx->nodfs) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_DFS; - if (ctx->noperm) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; - if (ctx->setuids) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SET_UID; - if (ctx->setuidfromacl) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UID_FROM_ACL; - if (ctx->server_ino) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SERVER_INUM; - if (ctx->remap) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MAP_SFM_CHR; - if (ctx->sfu_remap) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MAP_SPECIAL_CHR; - if (ctx->no_xattr) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_XATTR; - if (ctx->sfu_emul) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL; - if (ctx->nobrl) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL; - if (ctx->nohandlecache) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_HANDLE_CACHE; - if (ctx->nostrictsync) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NOSSYNC; - if (ctx->mand_lock) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NOPOSIXBRL; - if (ctx->rwpidforward) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_RWPIDFORWARD; - if (ctx->mode_ace) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MODE_FROM_SID; - if (ctx->cifs_acl) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; - if (ctx->backupuid_specified) { - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPUID; - } - if (ctx->backupgid_specified) { - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPGID; - } - if (ctx->override_uid) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; - if (ctx->override_gid) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID; - if (ctx->dynperm) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM; - if (ctx->fsc) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_FSCACHE; - if (ctx->multiuser) - cifs_sb->mnt_cifs_flags |= (CIFS_MOUNT_MULTIUSER | - CIFS_MOUNT_NO_PERM); - if (ctx->strict_io) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_STRICT_IO; - if (ctx->direct_io) { + smb3_update_mnt_flags(cifs_sb); + + if (ctx->direct_io) cifs_dbg(FYI, "mounting share using direct i/o\n"); - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; - } if (ctx->cache_ro) { cifs_dbg(VFS, "mounting share with read only caching. Ensure that the share will not be modified while in use.\n"); cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_RO_CACHE; @@ -2776,23 +2725,6 @@ int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb) cifs_sb->mnt_cifs_flags |= (CIFS_MOUNT_RO_CACHE | CIFS_MOUNT_RW_CACHE); } - if (ctx->mfsymlinks) { - if (ctx->sfu_emul) { - /* - * Our SFU ("Services for Unix" emulation does not allow - * creating symlinks but does allow reading existing SFU - * symlinks (it does allow both creating and reading SFU - * style mknod and FIFOs though). When "mfsymlinks" and - * "sfu" are both enabled at the same time, it allows - * reading both types of symlinks, but will only create - * them with mfsymlinks format. This allows better - * Apple compatibility (probably better for Samba too) - * while still recognizing old Windows style symlinks. - */ - cifs_dbg(VFS, "mount options mfsymlinks and sfu both enabled\n"); - } - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MF_SYMLINKS; - } if ((ctx->cifs_acl) && (ctx->dynperm)) cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index 4995082b7285..c1e53121526d 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -1362,3 +1362,158 @@ smb3_cleanup_fs_context(struct smb3_fs_context *ctx) smb3_cleanup_fs_context_contents(ctx); kfree(ctx); } + +void smb3_update_mnt_flags(struct cifs_sb_info *cifs_sb) +{ + struct smb3_fs_context *ctx = cifs_sb->ctx; + + if (ctx->nodfs) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_DFS; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_NO_DFS; + + if (ctx->noperm) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_NO_PERM; + + if (ctx->setuids) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SET_UID; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SET_UID; + + if (ctx->setuidfromacl) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UID_FROM_ACL; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_UID_FROM_ACL; + + if (ctx->server_ino) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SERVER_INUM; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; + + if (ctx->remap) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MAP_SFM_CHR; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_MAP_SFM_CHR; + + if (ctx->sfu_remap) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MAP_SPECIAL_CHR; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_MAP_SPECIAL_CHR; + + if (ctx->no_xattr) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_XATTR; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_NO_XATTR; + + if (ctx->sfu_emul) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_UNX_EMUL; + + if (ctx->nobrl) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_NO_BRL; + + if (ctx->nohandlecache) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_HANDLE_CACHE; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_NO_HANDLE_CACHE; + + if (ctx->nostrictsync) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NOSSYNC; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_NOSSYNC; + + if (ctx->mand_lock) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NOPOSIXBRL; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_NOPOSIXBRL; + + if (ctx->rwpidforward) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_RWPIDFORWARD; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_RWPIDFORWARD; + + if (ctx->mode_ace) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MODE_FROM_SID; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_MODE_FROM_SID; + + if (ctx->cifs_acl) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_CIFS_ACL; + + if (ctx->backupuid_specified) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPUID; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_CIFS_BACKUPUID; + + if (ctx->backupgid_specified) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPGID; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_CIFS_BACKUPGID; + + if (ctx->override_uid) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_OVERR_UID; + + if (ctx->override_gid) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_OVERR_GID; + + if (ctx->dynperm) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_DYNPERM; + + if (ctx->fsc) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_FSCACHE; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_FSCACHE; + + if (ctx->multiuser) + cifs_sb->mnt_cifs_flags |= (CIFS_MOUNT_MULTIUSER | + CIFS_MOUNT_NO_PERM); + else + cifs_sb->mnt_cifs_flags &= ~(CIFS_MOUNT_MULTIUSER | + CIFS_MOUNT_NO_PERM); + + if (ctx->strict_io) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_STRICT_IO; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_STRICT_IO; + + if (ctx->direct_io) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_DIRECT_IO; + + if (ctx->mfsymlinks) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MF_SYMLINKS; + else + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_MF_SYMLINKS; + if (ctx->mfsymlinks) { + if (ctx->sfu_emul) { + /* + * Our SFU ("Services for Unix" emulation does not allow + * creating symlinks but does allow reading existing SFU + * symlinks (it does allow both creating and reading SFU + * style mknod and FIFOs though). When "mfsymlinks" and + * "sfu" are both enabled at the same time, it allows + * reading both types of symlinks, but will only create + * them with mfsymlinks format. This allows better + * Apple compatibility (probably better for Samba too) + * while still recognizing old Windows style symlinks. + */ + cifs_dbg(VFS, "mount options mfsymlinks and sfu both enabled\n"); + } + } + + return; +} diff --git a/fs/cifs/fs_context.h b/fs/cifs/fs_context.h index 2519108eeb29..3358b33abcd0 100644 --- a/fs/cifs/fs_context.h +++ b/fs/cifs/fs_context.h @@ -266,5 +266,6 @@ static inline struct smb3_fs_context *smb3_fc2context(const struct fs_context *f } extern int smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx); +extern void smb3_update_mnt_flags(struct cifs_sb_info *cifs_sb); #endif From patchwork Mon Dec 14 06:40:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b6HazmGN; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz82PtLz9sT6 for ; Mon, 14 Dec 2020 17:42:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438794AbgLNGm0 (ORCPT ); Mon, 14 Dec 2020 01:42:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35655 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438787AbgLNGm0 (ORCPT ); Mon, 14 Dec 2020 01:42:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=XhcC3OU08WU4RxtHzw8d6PE90hPmKBy4P2ISa+oxGzA=; b=b6HazmGN+OooSYWph2mO9F2nk+bzQ3NMttjTjiQ1p7TDZae0EZNEFXAyfQRa/mdnY3KhuJ 1Tjl8gsk8cTKuC+/8cdCW6f7TA2rafrwiXv+UPVN3Aew4wQuMbQhde+GXtT21eeLmBzogB vie29NutQ84nWo9e7GxErFvb6wAnpyI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-528-qzmA1lp9NuOObadELIpUnA-1; Mon, 14 Dec 2020 01:40:58 -0500 X-MC-Unique: qzmA1lp9NuOObadELIpUnA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E2A9EA0CA1; Mon, 14 Dec 2020 06:40:57 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 470C628557; Mon, 14 Dec 2020 06:40:56 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 11/12] cifs: update mnt_cifs_flags during reconfigure Date: Mon, 14 Dec 2020 16:40:26 +1000 Message-Id: <20201214064027.2885-11-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Ronnie Sahlberg --- fs/cifs/fs_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index c1e53121526d..84a86e91127b 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -704,6 +704,7 @@ static int smb3_reconfigure(struct fs_context *fc) smb3_cleanup_fs_context_contents(cifs_sb->ctx); rc = smb3_fs_context_dup(cifs_sb->ctx, ctx); + smb3_update_mnt_flags(cifs_sb); return rc; } From patchwork Mon Dec 14 06:40:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 1415813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KEf2yx2r; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CvWz45lJPz9sSf for ; Mon, 14 Dec 2020 17:42:24 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438781AbgLNGmF (ORCPT ); Mon, 14 Dec 2020 01:42:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24044 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438779AbgLNGmE (ORCPT ); Mon, 14 Dec 2020 01:42:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607928038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=MjACw1QkYDzfTUQl5ZtWqUJFFe5a225FPPNnccHGqBE=; b=KEf2yx2rxsRemb27O2hraFs+DgMZ/rcIgQlFMJfgfTCeR6XjUiFoHP8f1DFA507lNfxqts vGUxh1NXRO6eM63rb2NCCYr5/5IRZ/b6yYuprjrgQJh7W64tLBke6E3CIXS1khddgwH3jb NrJyrAPqAObqp+ROdmg9D80CWNuccWI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-lbUhvnBEMUSOR7s6DNUikw-1; Mon, 14 Dec 2020 01:40:36 -0500 X-MC-Unique: lbUhvnBEMUSOR7s6DNUikw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F4BF800D62; Mon, 14 Dec 2020 06:40:35 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-107.bne.redhat.com [10.64.54.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87A96100164C; Mon, 14 Dec 2020 06:40:34 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 12/12] cifs: fix uninitialized variable in smb3_fs_context_parse_param Date: Mon, 14 Dec 2020 16:40:27 +1000 Message-Id: <20201214064027.2885-12-lsahlber@redhat.com> In-Reply-To: <20201214064027.2885-1-lsahlber@redhat.com> References: <20201214064027.2885-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Ronnie Sahlberg --- fs/cifs/fs_context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index 84a86e91127b..a6ca0a3dee76 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -725,8 +725,10 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, * we will need special handling of them. */ if (param->type == fs_value_is_string && param->string[0] == 0) { - if (!strcmp("pass", param->key) || !strcmp("password", param->key)) + if (!strcmp("pass", param->key) || !strcmp("password", param->key)) { skip_parsing = true; + opt = Opt_pass; + } } if (!skip_parsing) {