From patchwork Sun Jan 30 09:34:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 12729775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EEEAC433EF for ; Sun, 30 Jan 2022 09:35:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345429AbiA3JfB (ORCPT ); Sun, 30 Jan 2022 04:35:01 -0500 Received: from mail-pf1-f174.google.com ([209.85.210.174]:36799 "EHLO mail-pf1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240045AbiA3JfB (ORCPT ); Sun, 30 Jan 2022 04:35:01 -0500 Received: by mail-pf1-f174.google.com with SMTP id 192so10212482pfz.3 for ; Sun, 30 Jan 2022 01:35:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lsuttai6p75hcwwPCm2Jdb0rN4+uDFqe4PEhjFJ8c98=; b=D9pDu0Yqluo8ZNMpm95sf00St+mVtPsqPY2EkUcc88IqilXFqr+g7iJRWq0wPs+aWt 4PClz1hy7C3ktPrFyTsOxjyDDZPBMnbY1PpPRQEWp6148ntSsbIBNo450X2dwQC9Xffh F55WX0nRSSq4Ti2blyzjiuNZMZmleb7baZ5GIjgLeJV4s6uwBbD9omgRY3Mk8PQx+PJz xa7AHt+WIKl6rgaIGdo1jC2MclGQi9ncEczuHSdNGG7lKBwG8chxo4p8Z78uMhmNtlxg 6SkKJkkwjlJIpA8JLJoHspPBBCJ1w4wWfuqFbJv03WxCUsLfjFKafKbvnICQlB2smpY2 9JDQ== X-Gm-Message-State: AOAM533rafofsouzZfsR5cV8JEfKAsseq8A0xLeKBz0iU98Fl5g4df+D 5H6nhyzqyZ1hN0wJndGzm77BZiWewNU= X-Google-Smtp-Source: ABdhPJz/1hMk1GVLLdzMBw9WokqnUWrmSQM06s62RIeVCM2lDrEUa7K4FF/NhNOdvkk7oWod59u0sQ== X-Received: by 2002:a62:1852:: with SMTP id 79mr15792283pfy.69.1643535300571; Sun, 30 Jan 2022 01:35:00 -0800 (PST) Received: from localhost.localdomain ([61.74.27.164]) by smtp.gmail.com with ESMTPSA id l22sm14991798pfc.191.2022.01.30.01.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 01:35:00 -0800 (PST) From: Namjae Jeon To: linux-cifs@vger.kernel.org Cc: Namjae Jeon Subject: [PATCH 1/3] ksmbd: reduce smb direct max read/write size Date: Sun, 30 Jan 2022 18:34:31 +0900 Message-Id: <20220130093433.8319-1-linkinjeon@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org To support RDMA in chelsio NICs, Reduce smb direct read/write size to about 512KB. With this change, we have checked that a single buffer descriptor was sent from Windows client, and intel X722 was operated at that size. Signed-off-by: Namjae Jeon --- fs/ksmbd/transport_rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c index 3c1ec1ac0b27..ba5a22bc2e6d 100644 --- a/fs/ksmbd/transport_rdma.c +++ b/fs/ksmbd/transport_rdma.c @@ -80,7 +80,7 @@ static int smb_direct_max_fragmented_recv_size = 1024 * 1024; /* The maximum single-message size which can be received */ static int smb_direct_max_receive_size = 8192; -static int smb_direct_max_read_write_size = 1048512; +static int smb_direct_max_read_write_size = 524224; static int smb_direct_max_outstanding_rw_ops = 8; From patchwork Sun Jan 30 09:34:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 12729776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCA10C433F5 for ; Sun, 30 Jan 2022 09:35:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346067AbiA3JfE (ORCPT ); Sun, 30 Jan 2022 04:35:04 -0500 Received: from mail-pj1-f52.google.com ([209.85.216.52]:41694 "EHLO mail-pj1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240045AbiA3JfD (ORCPT ); Sun, 30 Jan 2022 04:35:03 -0500 Received: by mail-pj1-f52.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so10812511pjp.0 for ; Sun, 30 Jan 2022 01:35:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SnhexiQVmmAONSx5nCO1R/NLidon3M/7mu7IvRTFeCM=; b=caWBzphCz2mmB0wAl5Y11p7BWOCFZ68NtWmRDVCEO/RbTlRwNQkaeJP28CeyDc992g 6m4MexToavhM5r4TUsyywLkwm7MQcd6YuRhwn7t0Ue3KJgahtXKmtB10Ee5UmrkxpjVN 6dBTuaG+bP30EP+PD/X0ORJEUViJJ0J4tIVTdj9pCvdAifca/JPHRBN6P9ggRES2I9B2 1qso6Se6eRw6lctUKWQjOJjRLzYGOVjdchRTg/FfrW/kZWuqbnuIqhXLW/xQGGzUu8fy MMq8iVJCxGLCnB9OglNxbahU2rZsjE8IvXzWLyAxFrGl3wxeSU8RSI/uew/73rNVhYJX WKCQ== X-Gm-Message-State: AOAM5302YwO1IllPVWj6eesYIzBw31duXsGa6Px3YIP4Sa8XSzfhwGw5 4m6HvlTfUxJd1UB7KOueHy9FPK/UiNQ= X-Google-Smtp-Source: ABdhPJyETm+/TgFKBi1YqwekJbWOCONrmIj4M7CnAhaoKGV+QsrQglmRr6nX6f5ez/I7UoZEpbwMOw== X-Received: by 2002:a17:902:e844:: with SMTP id t4mr16057298plg.104.1643535303100; Sun, 30 Jan 2022 01:35:03 -0800 (PST) Received: from localhost.localdomain ([61.74.27.164]) by smtp.gmail.com with ESMTPSA id l22sm14991798pfc.191.2022.01.30.01.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 01:35:02 -0800 (PST) From: Namjae Jeon To: linux-cifs@vger.kernel.org Cc: Namjae Jeon Subject: [PATCH 2/3] ksmbd: fix same UniqueId for dot and dotdot entries Date: Sun, 30 Jan 2022 18:34:32 +0900 Message-Id: <20220130093433.8319-2-linkinjeon@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220130093433.8319-1-linkinjeon@kernel.org> References: <20220130093433.8319-1-linkinjeon@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org ksmbd sets the inode number to UniqueId. However, the same UniqueId for dot and dotdot entry is set to the inode number of the parent inode. This patch set them using the current inode and parent inode. Signed-off-by: Namjae Jeon --- fs/ksmbd/smb_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ksmbd/smb_common.c b/fs/ksmbd/smb_common.c index ef7f42b0290a..9a7e211dbf4f 100644 --- a/fs/ksmbd/smb_common.c +++ b/fs/ksmbd/smb_common.c @@ -308,14 +308,17 @@ int ksmbd_populate_dot_dotdot_entries(struct ksmbd_work *work, int info_level, for (i = 0; i < 2; i++) { struct kstat kstat; struct ksmbd_kstat ksmbd_kstat; + struct dentry *dentry; if (!dir->dot_dotdot[i]) { /* fill dot entry info */ if (i == 0) { d_info->name = "."; d_info->name_len = 1; + dentry = dir->filp->f_path.dentry; } else { d_info->name = ".."; d_info->name_len = 2; + dentry = dir->filp->f_path.dentry->d_parent; } if (!match_pattern(d_info->name, d_info->name_len, @@ -327,7 +330,7 @@ int ksmbd_populate_dot_dotdot_entries(struct ksmbd_work *work, int info_level, ksmbd_kstat.kstat = &kstat; ksmbd_vfs_fill_dentry_attrs(work, user_ns, - dir->filp->f_path.dentry->d_parent, + dentry, &ksmbd_kstat); rc = fn(conn, info_level, d_info, &ksmbd_kstat); if (rc) From patchwork Sun Jan 30 09:34:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 12729777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B3AFC433F5 for ; Sun, 30 Jan 2022 09:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354323AbiA3JfH (ORCPT ); Sun, 30 Jan 2022 04:35:07 -0500 Received: from mail-pj1-f48.google.com ([209.85.216.48]:50827 "EHLO mail-pj1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240045AbiA3JfF (ORCPT ); Sun, 30 Jan 2022 04:35:05 -0500 Received: by mail-pj1-f48.google.com with SMTP id o11so10829322pjf.0 for ; Sun, 30 Jan 2022 01:35:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mreh1xcakx/Ki8oc8LKYbi6a4wCQOW17xUOm8jgz59w=; b=0DJjlNxVqG9EMYSXfL9qKRt/vCiGqFg0tldHMpvQfCShYFGGQMwn7HgbncCptczl8R 5oNagAnhU1QtTtCRxRDezNkwJrd/JGP61s7eXrZ6Dz3rJZDM7aZ45FIzFTCpivKfRQ9K An7L09NLppNGOckBFrOKfooibNbhRKqp+r4yjYxic0ChRGf4ZFJpQakBnKFhVMJaqWsm x8XRzEQam+b2PoHVpwYmLTSWxVX6VOwAe5fixaOtbUF1IGhe9ywEigb4XO9XBjyoELj7 EC/qNVEoOX64c83LaBsEfZmv3UyyhFPHSNG/+l21DIxlHAWBih3gFmowBaQAU2DarFPr CO+A== X-Gm-Message-State: AOAM533ZXbGxMGT2BAp9MwpVuptSCiY/dZI/wNvcKhJwqkymrJ/Yc5ca Mb4mZD+LqWicJaAt7dVgUOtGalh/eCk= X-Google-Smtp-Source: ABdhPJzzTQwf1ip6ijdvpQhPL9XbCenTluqjoX2LHsyH/3ZD4rqBQnAH0kW7m6sa+GZAAx7CTaOa8Q== X-Received: by 2002:a17:902:e541:: with SMTP id n1mr15892199plf.108.1643535305323; Sun, 30 Jan 2022 01:35:05 -0800 (PST) Received: from localhost.localdomain ([61.74.27.164]) by smtp.gmail.com with ESMTPSA id l22sm14991798pfc.191.2022.01.30.01.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 01:35:05 -0800 (PST) From: Namjae Jeon To: linux-cifs@vger.kernel.org Cc: Namjae Jeon Subject: [PATCH 3/3] ksmbd: don't align last entry offset in smb2 query directory Date: Sun, 30 Jan 2022 18:34:33 +0900 Message-Id: <20220130093433.8319-3-linkinjeon@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220130093433.8319-1-linkinjeon@kernel.org> References: <20220130093433.8319-1-linkinjeon@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org When checking smb2 query directory packets from other servers, OutputBufferLength is different with ksmbd. Other servers add an unaligned next offset to OutputBufferLength for the last entry. Signed-off-by: Namjae Jeon --- fs/ksmbd/smb2pdu.c | 7 ++++--- fs/ksmbd/vfs.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 6806994383d9..67e8e28e3fc3 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -3422,9 +3422,9 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level, goto free_conv_name; } - struct_sz = readdir_info_level_struct_sz(info_level); - next_entry_offset = ALIGN(struct_sz - 1 + conv_len, - KSMBD_DIR_INFO_ALIGNMENT); + struct_sz = readdir_info_level_struct_sz(info_level) - 1 + conv_len; + next_entry_offset = ALIGN(struct_sz, KSMBD_DIR_INFO_ALIGNMENT); + d_info->last_entry_off_align = next_entry_offset - struct_sz; if (next_entry_offset > d_info->out_buf_len) { d_info->out_buf_len = 0; @@ -3976,6 +3976,7 @@ int smb2_query_dir(struct ksmbd_work *work) ((struct file_directory_info *) ((char *)rsp->Buffer + d_info.last_entry_offset)) ->NextEntryOffset = 0; + d_info.data_count -= d_info.last_entry_off_align; rsp->StructureSize = cpu_to_le16(9); rsp->OutputBufferOffset = cpu_to_le16(72); diff --git a/fs/ksmbd/vfs.h b/fs/ksmbd/vfs.h index adf94a4f22fa..8c37aaf936ab 100644 --- a/fs/ksmbd/vfs.h +++ b/fs/ksmbd/vfs.h @@ -47,6 +47,7 @@ struct ksmbd_dir_info { int last_entry_offset; bool hide_dot_file; int flags; + int last_entry_off_align; }; struct ksmbd_readdir_data {