From nobody Thu Apr 2 15:38:00 2026 Received: from n169-111.mail.139.com (n169-111.mail.139.com [120.232.169.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 671EE3D76; Wed, 11 Feb 2026 05:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=120.232.169.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770789289; cv=none; b=JBKHZ2VrB4VNe+w+E18S76FqQyxCyQXuFKQteSsE+75PTV0dCdh4ordo+A2PKlsBGo4whhPCBL1wl5NVVXLUm/KnQ78H+cJqImxWcE/eYCLmgIKX7M4+A0XbA8ufEsOylY99naXv928DGO6Z3LdNrRE8u5RGbiHYNFEzQcOlZTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770789289; c=relaxed/simple; bh=uZiMnq99ICq86/Zw28Eaejl91Vp6nQDHFb9LoqGCz3k=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TBgkSbmlT1E6vxUbpXJ+TFH9JsAoa3H4F420jBL9hGWGz11sfI1KFPBpsE8xuWngkfkW9jDMp1+cN8itVKWo2YTNi/mwPgjPDXi6Wu4MZUziMvq3XGB2DHPKIEn+0BWCUMwteYl+T3V3o+TqIdxEkF0ynTFoI24oL3V84wPauiY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=139.com; spf=pass smtp.mailfrom=139.com; dkim=pass (1024-bit key) header.d=139.com header.i=@139.com header.b=CcxxEm9Z; arc=none smtp.client-ip=120.232.169.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=139.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=139.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=139.com header.i=@139.com header.b="CcxxEm9Z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=139.com; s=dkim; l=0; h=from:subject:message-id:to:cc:mime-version; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=CcxxEm9Z8purwPMhiOuvzkMboCBtBA/JMl217Qcyv7NVM6nf82/md5XexoxbOZBfwEw+EamGbehil cZ6nqM3qoOL3juO2o8jGUIv7JHV+BRKFAui0TcUb2wszhu8/Zi1B/HtkAuRoRGuT0L+UrZr2Qg+AVy ACZPqr2u9Gk6Uglo= X-RM-TagInfo: emlType=0 X-RM-SPAM: X-RM-SPAM-FLAG: 00000000 Received: from NTT-kernel-dev (unknown[60.247.85.88]) by rmsmtp-lg-appmail-10-12088 (RichMail) with SMTP id 2f38698c199c6a4-026d4; Wed, 11 Feb 2026 13:54:39 +0800 (CST) X-RM-TRANSID: 2f38698c199c6a4-026d4 From: Li hongliang <1468888505@139.com> To: gregkh@linuxfoundation.org, stable@vger.kernel.org, linkinjeon@kernel.org Cc: patches@lists.linux.dev, linux-kernel@vger.kernel.org, sfrench@samba.org, senozhatsky@chromium.org, tom@talpey.com, ddiss@suse.de, linux-cifs@vger.kernel.org, stfrench@microsoft.com Subject: [PATCH 6.1.y] ksmbd: set ATTR_CTIME flags when setting mtime Date: Wed, 11 Feb 2026 13:54:37 +0800 Message-Id: <20260211055437.2798668-1-1468888505@139.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Namjae Jeon [ Upstream commit 21e46a79bbe6c4e1aa73b3ed998130f2ff07b128 ] David reported that the new warning from setattr_copy_mgtime is coming like the following. [ 113.215316] ------------[ cut here ]------------ [ 113.215974] WARNING: CPU: 1 PID: 31 at fs/attr.c:300 setattr_copy+0x1ee/= 0x200 [ 113.219192] CPU: 1 UID: 0 PID: 31 Comm: kworker/1:1 Not tainted 6.13.0-r= c1+ #234 [ 113.220127] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014 [ 113.221530] Workqueue: ksmbd-io handle_ksmbd_work [ksmbd] [ 113.222220] RIP: 0010:setattr_copy+0x1ee/0x200 [ 113.222833] Code: 24 28 49 8b 44 24 30 48 89 53 58 89 43 6c 5b 41 5c 41 = 5d 41 5e 41 5f 5d c3 cc cc cc cc 48 89 df e8 77 d6 ff ff e9 cd fe ff ff <0f= > 0b e9 be fe ff ff 66 0 [ 113.225110] RSP: 0018:ffffaf218010fb68 EFLAGS: 00010202 [ 113.225765] RAX: 0000000000000120 RBX: ffffa446815f8568 RCX: 00000000000= 00003 [ 113.226667] RDX: ffffaf218010fd38 RSI: ffffa446815f8568 RDI: ffffffff94e= b03a0 [ 113.227531] RBP: ffffaf218010fb90 R08: 0000001a251e217d R09: 00000000675= 259fa [ 113.228426] R10: 0000000002ba8a6d R11: ffffa4468196c7a8 R12: ffffaf21801= 0fd38 [ 113.229304] R13: 0000000000000120 R14: ffffffff94eb03a0 R15: 00000000000= 00000 [ 113.230210] FS: 0000000000000000(0000) GS:ffffa44739d00000(0000) knlGS:= 0000000000000000 [ 113.231215] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 113.232055] CR2: 00007efe0053d27e CR3: 000000000331a000 CR4: 00000000000= 006b0 [ 113.232926] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000= 00000 [ 113.233812] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 00000000000= 00400 [ 113.234797] Call Trace: [ 113.235116] [ 113.235393] ? __warn+0x73/0xd0 [ 113.235802] ? setattr_copy+0x1ee/0x200 [ 113.236299] ? report_bug+0xf3/0x1e0 [ 113.236757] ? handle_bug+0x4d/0x90 [ 113.237202] ? exc_invalid_op+0x13/0x60 [ 113.237689] ? asm_exc_invalid_op+0x16/0x20 [ 113.238185] ? setattr_copy+0x1ee/0x200 [ 113.238692] btrfs_setattr+0x80/0x820 [btrfs] [ 113.239285] ? get_stack_info_noinstr+0x12/0xf0 [ 113.239857] ? __module_address+0x22/0xa0 [ 113.240368] ? handle_ksmbd_work+0x6e/0x460 [ksmbd] [ 113.240993] ? __module_text_address+0x9/0x50 [ 113.241545] ? __module_address+0x22/0xa0 [ 113.242033] ? unwind_next_frame+0x10e/0x920 [ 113.242600] ? __pfx_stack_trace_consume_entry+0x10/0x10 [ 113.243268] notify_change+0x2c2/0x4e0 [ 113.243746] ? stack_depot_save_flags+0x27/0x730 [ 113.244339] ? set_file_basic_info+0x130/0x2b0 [ksmbd] [ 113.244993] set_file_basic_info+0x130/0x2b0 [ksmbd] [ 113.245613] ? process_scheduled_works+0xbe/0x310 [ 113.246181] ? worker_thread+0x100/0x240 [ 113.246696] ? kthread+0xc8/0x100 [ 113.247126] ? ret_from_fork+0x2b/0x40 [ 113.247606] ? ret_from_fork_asm+0x1a/0x30 [ 113.248132] smb2_set_info+0x63f/0xa70 [ksmbd] ksmbd is trying to set the atime and mtime via notify_change without also setting the ctime. so This patch add ATTR_CTIME flags when setting mtime to avoid a warning. Reported-by: David Disseldorp Signed-off-by: Namjae Jeon Signed-off-by: Steve French [ Minor conflict resolved. ] Signed-off-by: Li hongliang <1468888505@139.com> --- fs/smb/server/smb2pdu.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 100016298f87..5383b8e2e9d2 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -5736,15 +5736,13 @@ static int set_file_basic_info(struct ksmbd_file *f= p, attrs.ia_valid |=3D (ATTR_ATIME | ATTR_ATIME_SET); } =20 - attrs.ia_valid |=3D ATTR_CTIME; if (file_info->ChangeTime) - attrs.ia_ctime =3D ksmbd_NTtimeToUnix(file_info->ChangeTime); - else - attrs.ia_ctime =3D inode->i_ctime; + inode_set_ctime_to_ts(inode, + ksmbd_NTtimeToUnix(file_info->ChangeTime)); =20 if (file_info->LastWriteTime) { attrs.ia_mtime =3D ksmbd_NTtimeToUnix(file_info->LastWriteTime); - attrs.ia_valid |=3D (ATTR_MTIME | ATTR_MTIME_SET); + attrs.ia_valid |=3D (ATTR_MTIME | ATTR_MTIME_SET | ATTR_CTIME); } =20 if (file_info->Attributes) { @@ -5786,8 +5784,6 @@ static int set_file_basic_info(struct ksmbd_file *fp, return -EACCES; =20 inode_lock(inode); - inode->i_ctime =3D attrs.ia_ctime; - attrs.ia_valid &=3D ~ATTR_CTIME; rc =3D notify_change(user_ns, dentry, &attrs, NULL); inode_unlock(inode); } --=20 2.34.1