Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3444012imu; Mon, 17 Dec 2018 21:08:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/VcVxMDe36S6ahLMFKL433LmgZV4krrOYdI9XfrrC2dpOgmE023gOeyz7zXiQMt13zaAuCQ X-Received: by 2002:a63:9306:: with SMTP id b6mr13932703pge.36.1545109689622; Mon, 17 Dec 2018 21:08:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545109689; cv=none; d=google.com; s=arc-20160816; b=IpkVDZL28B+1AinWd2W4OL9PNqgT8QsxmvoaZkoFwhbXp4uwbX9GbdnsKZrRDYuWrx 6WSJlfCdGPCtbGeFcusWQkoC6HRF6pkYuNEIYS/VqCz4ilbPEJYTaOGZ3qAZZ27tLXfn I/Djr1wVt6cEm23c9jFOKjKJSM4MtCNVsFeZ46W66me2fpRJVzD01oXK9GdEo0OlQplZ xnL7/nh1n9ziadFAkA5dgrH286rd3hWruNGUDx6xRIlDGoLF009P7M1EqvmurOBxDH2I Xx6H60kk3Yo/DDywsFWuc6aFgY8pLMzpswJYy7GiNRohXuOpx5Wl6/5eLt1T/FOb2V7F 9l6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pktrFD8srfTcPs5y3ak7/CEWAGgVk+nF3nTuxokaMBY=; b=RJyFttqDPjm+NJw7VIND18i0LSqDACNIX5QfsTX5g7xchNeg5WATTMbb2LKBSkiYdZ JUEkHmWzmaqWdyXPHNyvMpst8OxgdUp+4RDyU1df3Bq9tCfDNAkkcidFki+KxFcYE211 iQxOlsX0V62EvwKOpoJVo5XJpb1elFV3vxN+bNYaZ2q2/AUd6mq06WR7xlyjm335GVsz GnGU5KSdgyUUt65bbC8QUeo87oeuTnjHWeCfA/cLr29GqJkrvMt/HcGvayv/MLIOZDRG 6R5cRhVBGXLBfWfEUEbEYdRK/D5aoY2WUHWhE39Cd4AcnVGh5ajSfReYbvmf7Qw+CKOJ Gz/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MPRpcIaL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30si2479083pgv.191.2018.12.17.21.07.54; Mon, 17 Dec 2018 21:08:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MPRpcIaL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726712AbeLRFGC (ORCPT + 99 others); Tue, 18 Dec 2018 00:06:02 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40902 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726567AbeLRFGB (ORCPT ); Tue, 18 Dec 2018 00:06:01 -0500 Received: by mail-pg1-f194.google.com with SMTP id z10so7227094pgp.7; Mon, 17 Dec 2018 21:06:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pktrFD8srfTcPs5y3ak7/CEWAGgVk+nF3nTuxokaMBY=; b=MPRpcIaLhy5l6ykb4PvTOVDVanPWdRFekcg2M31aamGxvWVhUr6MYsTmzOHeg+b3Hg J8GLxElJNmpAqpqtm5xyz04bzUgAJ1zsgCO/pBiOP657+5YTQ/i7DFKXFdV5ZLrSDYJH eqlw/g0fjerWgGmEDg5+L1mpRq2mMa+w6PALvSXzMm/yuRm4CqMowqzmr5SaNZRYmKJn 2D9L1bsO1JPHVSKYMqOA7QpU0Bp/9oT92xBtDSMU2uZa+v7r9FsNvUC/ufXBppt06vLQ nM4K7rj+KOjyF07PP6psIRL4BO972fNd6OUPZQvetDcnAQLC4o7dFM4bLqZ+MFvY+Emw t9Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pktrFD8srfTcPs5y3ak7/CEWAGgVk+nF3nTuxokaMBY=; b=Zovuqf49oH8rgz1L0SFSBL+K7DPBN1xh6qu3XIJxp34+0ybgTxxktBYCD0EwbFGvnR phL9UXTsL138tglh7UyM+OnJx5VlqFohZ9e0ke15/16zPAb2VDx3L07h2XTV/1MOvfpl YXIU/96C6qfvnvQdtN7LB6HhLI7PxBwkS0mCyIRtAL6/SsqHagnPtpVsR4piajW7PjAL 17Civ/hW2/bDgK8TfcKkywBotV2mScHLZaM+xPriIQT0DpNpAJXSNa2hUPeMjY4qhCQy LUvVgMZwU4c7peICwHdTfX0VWIaaJ/kg7mbkBuApumM0sbTUuOSWWENj3ADJxh+bk2o+ QFkw== X-Gm-Message-State: AA+aEWZTdcs11oAd6QWAwPPA9raWnKAGFNvAc3SvvhopQn42vNkE8ZyL Xlhlg4BjWYeJvj/45vv39hcat9bgIKVBB+oEI3eEhg== X-Received: by 2002:a63:a112:: with SMTP id b18mr14622934pgf.440.1545109560630; Mon, 17 Dec 2018 21:06:00 -0800 (PST) MIME-Version: 1.0 References: <20181216231704.16761-1-longli@linuxonhyperv.com> In-Reply-To: <20181216231704.16761-1-longli@linuxonhyperv.com> From: Steve French Date: Mon, 17 Dec 2018 23:05:48 -0600 Message-ID: Subject: Re: [PATCH] CIFS: use the correct length when pinning memory for direct I/O for write To: Long Li Cc: Steve French , CIFS , samba-technical , LKML , linux-rdma@vger.kernel.org, Stable Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org merged into cifs-2.6.git for-next On Sun, Dec 16, 2018 at 5:18 PM Long Li wrote: > > From: Long Li > > The current code attempts to pin memory using the largest possible wsize > based on the currect SMB credits. This doesn't cause kernel oops but this is > not optimal as we may pin more pages then actually needed. > > Fix this by only pinning what are needed for doing this write I/O. > > Signed-off-by: Long Li > Cc: stable@vger.kernel.org > --- > fs/cifs/file.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/cifs/file.c b/fs/cifs/file.c > index 3467351..c23bf9d 100644 > --- a/fs/cifs/file.c > +++ b/fs/cifs/file.c > @@ -2617,11 +2617,13 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, > if (rc) > break; > > + cur_len = min_t(const size_t, len, wsize); > + > if (ctx->direct_io) { > ssize_t result; > > result = iov_iter_get_pages_alloc( > - from, &pagevec, wsize, &start); > + from, &pagevec, cur_len, &start); > if (result < 0) { > cifs_dbg(VFS, > "direct_writev couldn't get user pages " > -- > 2.7.4 > -- Thanks, Steve