From patchwork Tue Jul 23 05:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1963538 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=HG7nrWMX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-cifs+bounces-2338-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WSlXW6s0zz1yZw for ; Tue, 23 Jul 2024 15:08:11 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5E3362824F9 for ; Tue, 23 Jul 2024 05:08:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8394E13B78A; Tue, 23 Jul 2024 05:08:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HG7nrWMX" X-Original-To: linux-cifs@vger.kernel.org Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B464F139CFE for ; Tue, 23 Jul 2024 05:08:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721711285; cv=none; b=h8RLvwuBnHc+P54CmXVePHoRRLuC7aP0D1h0kR7yMBISufqZnlDWiM2JjqlsBZuxTAg8xCt9aJYnFq2s4GAYO7DzRUVU40/cWLVmVZtkSVOpK29zxvvC3u1o3xlXVqZb80MxdcRePh+yM0y2HR2VkNo/8/gVMVKyW9yuI4Ax4Qk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721711285; c=relaxed/simple; bh=viy8Xk35DCqbKxDZMZslIj10fmEWJTSUP9wlcEt8rXs=; h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Content-Type; b=HrETzroX+AzrotjUkkxc+JTyy0y85TWdBKY3Z2TZdTkq5eewg8DAwqEHCcAZM0OfeG5zsiu7SUBswzTNR7ln/BA1eIFJ5CFabcp4JF6voVy3PPFP9I87Z8xdFvjY+uLFyJXVSJMoaBqQ07v+WKq0l2iX3IlvwhOb0Frjxl2/v9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HG7nrWMX; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52f04c29588so2250375e87.3 for ; Mon, 22 Jul 2024 22:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721711282; x=1722316082; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=PqpSyzfOqfBgpniyCbv/7Z74nENzVCrnnHH4dQbwPEk=; b=HG7nrWMXMlPnWSkuyTRXPJ6yhg8rDpj873PcY1Dpxa76ThccRCy5OQ3B96qnr06Wuu Vfa466CLW51TTCPoVntJvhrNX5uFfuRxXub5hhd8Gq+s57pFqlPxhjtusO8mNtqNgc+e 0D7nFzXetksqK39xy7c896llsoXnogXc6+bnzcjK9dIK4+d8u/6VfjFk5iHXo69gcYzu vF9lDevHPhkPc4HaDc0Ik2pQlc3G4SsBtiJAAp5LA8vwe7aAfcguzVp6BPODMI73YyQz cyoCf6W3BTHGLtFsCgE/I4RR0qeY5jdPnzoNBIrNEL+3/bsIDErAWfM5lfQq0/WqA54V 5OGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721711282; x=1722316082; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PqpSyzfOqfBgpniyCbv/7Z74nENzVCrnnHH4dQbwPEk=; b=wzyumtZp85buIAJkJzGIiEueu3x4Njnc98VHesIZ2zVkJF86hAqIFRAsv/LAMbyoEE dGm8nuoCBrvjxNR6d2VohUwOgyJ8qEsZZfhChKvabqbEEbWApwxMSoNCluAa1A1WJaSy imk3ahxMtLMbyb/IXehajKelfefZ3o7WlypJgWVLPnRvp8gOBkUBgtkV6o4aMhWkY6Mf ywp4b/f+tllYDHhySftJVsN9VSX3Yb+u+02OcPnzQh6MSjbbST2S5Xs+kxhuh9nbEpgY weDFhoEjENp5+M98jnRBiOFhbDIwApqrXfxyGHuSJkRDPW3FeJwMpMvjSG1b/wkNiJMM 8DnQ== X-Forwarded-Encrypted: i=1; AJvYcCVieY5poxVlze8rLUbOcsj40/ZZYx1wlGueWz/VIHVr73mso5j3TS/DvGrSy+NlCKJiobN1S1wYS9KvfScCqYHM2zGcTTvnKGWvig== X-Gm-Message-State: AOJu0YyceamcYWnduUdQMCec7Q6C2/3euFPp1qyhRswgemj3R2/yr5JO zvuABd+3dxwUrkuTbWzFnhGliljmvQzsxXWkQ0Oo/MK2y7asp+P8f2VO4ugfpEzfCsaFKzSvNpI RucteK35YCicXFHOF1TBEVWBsNO4tY1QJ X-Google-Smtp-Source: AGHT+IGFaeQAFoLrUxTqgAbwSwnExwQvEx8ysZRM+N6jejJsr3AfjoUEc5Fmt5oU6JOXIMqMqOS9LInBiS+YhWPdty4= X-Received: by 2002:a05:6512:2209:b0:52e:f2a6:8e1a with SMTP id 2adb3069b0e04-52efb7e8103mr6118513e87.29.1721711281502; Mon, 22 Jul 2024 22:08:01 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steve French Date: Tue, 23 Jul 2024 00:07:50 -0500 Message-ID: Subject: [PATCH][CIFS] fix reconnect with SMB1 Unix Extensions To: Andrew Bartlett , samba-technical , CIFS , Kevin Ottens Cc: Paulo Alcantara Andrew had pointed out having problems with SMB1 Unix extensions to Samba when investigating an unrelated problem, and when I tried it I noticed a serious reconnect issue with the SMB1 Unix Extensions. When mounting with the SMB1 Unix Extensions (e.g. mounts to Samba with vers=1.0), cifs.ko reconnects no longer reset the Unix Extensions (SetFSInfo SET_FILE_UNIX_BASIC) after tcon so most operations (e.g. stat, ls, open, statfs) will fail continuously with: "Operation not supported" if the connection ever resets (e.g. due to brief network disconnect) Fix attached From 2a9b3eb1b0838cc99aafdc50e37138538d4593bb Mon Sep 17 00:00:00 2001 From: Steve French Date: Mon, 22 Jul 2024 23:40:08 -0500 Subject: [PATCH] cifs: fix reconnect with SMB1 UNIX Extensions When mounting with the SMB1 Unix Extensions (e.g. mounts to Samba with vers=1.0), reconnects no longer reset the Unix Extensions (SetFSInfo SET_FILE_UNIX_BASIC) after tcon so most operations (e.g. stat, ls, open, statfs) will fail continuously with: "Operation not supported" if the connection ever resets (e.g. due to brief network disconnect) Cc: stable@vger.kernel.org Signed-off-by: Steve French --- fs/smb/client/connect.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index 7a16e12f5da8..b66d8b03a389 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -3807,8 +3807,21 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses, else tcon->Flags = 0; cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags); - } + /* + * reset_cifs_unix_caps calls QFSInfo which requires + * need_reconnect to be false, but we would not need to call + * reset_caps if this were not a reconnect case so must check + * need_reconnect flag here. The caller will also clear + * need_reconnect when tcon was successful but needed to be + * cleared earlier in the case of unix extensions reconnect + */ + if (tcon->need_reconnect && tcon->unix_ext) { + cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name); + tcon->need_reconnect = false; + reset_cifs_unix_caps(xid, tcon, NULL, NULL); + } + } cifs_buf_release(smb_buffer); return rc; } -- 2.43.0