From patchwork Tue Oct 7 17:59:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5048281 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F3D4E9F2F1 for ; Tue, 7 Oct 2014 18:00:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42E662017D for ; Tue, 7 Oct 2014 18:00:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4924E2016C for ; Tue, 7 Oct 2014 18:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754557AbaJGSAK (ORCPT ); Tue, 7 Oct 2014 14:00:10 -0400 Received: from mail-vc0-f182.google.com ([209.85.220.182]:40830 "EHLO mail-vc0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753764AbaJGSAJ (ORCPT ); Tue, 7 Oct 2014 14:00:09 -0400 Received: by mail-vc0-f182.google.com with SMTP id la4so5397593vcb.27 for ; Tue, 07 Oct 2014 11:00:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8AL5auCtkWPmv9Bv8r3/fcbTr0ekEpk8oGmozHNdyH4=; b=OeHNFPiz3aMRAUxMPU/GxW0V3BZAQB9aE9W0yrb1QxzdqBAQ/ejcr3f2OASt1fibex aFzx28WA+ydVqLsg9BRdfkSHt2kV0G+tNaxU9Ufg4VLXV0xU3rcIbPRmEw0kLUCrRxAp sJSpJrfXka0ignn/D7t1V3GwtY0co8FYvRQqofTxXemuz1UJTJsXylT6IL4yc2/eRgsz AJF0uCnpqh6ZFWVA3ZTf3/Z8aancGUWqwMO/07dOplScdee3N8vHJUPmrrW8JIeR1Mbx 2ABSxa21T2rhHb0tkwBP36d6i663VDvLMJcFYk61eGJYKwhZXhxdxv9UdJNXq2ZBDj+V M4Rw== X-Gm-Message-State: ALoCoQkh1KDx+IwUTn+7G6jta6t3VDt21N6BjRGXXc32pDhynWlo24PpZa7Oy8xLpQfIj//GdEBk X-Received: by 10.220.195.196 with SMTP id ed4mr334541vcb.59.1412704808658; Tue, 07 Oct 2014 11:00:08 -0700 (PDT) Received: from localhost.localdomain (nat-pool-rdu-u.redhat.com. [66.187.233.203]) by mx.google.com with ESMTPSA id l1sm5504805vdi.11.2014.10.07.11.00.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Oct 2014 11:00:08 -0700 (PDT) From: Thomas Haynes X-Google-Original-From: Thomas Haynes To: Trond Myklebust Cc: Linux NFS Mailing list , Tom Haynes Subject: [PATCH] pnfs: Do not schedule layout segment work if there is no work to be done. Date: Tue, 7 Oct 2014 10:59:47 -0700 Message-Id: <1412704787-46388-1-git-send-email-Thomas.Haynes@primarydata.com> X-Mailer: git-send-email 1.9.3 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Haynes Callers of pnfs_put_lseg_async() might encounter no writes to be committed, etc. As such, do not attempt to add work if none is needed. Also, don't oops if that is the case. Signed-off-by: Tom Haynes --- fs/nfs/pnfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 76de7f5..08b1060 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -373,6 +373,9 @@ static void pnfs_put_lseg_async_work(struct work_struct *work) void pnfs_put_lseg_async(struct pnfs_layout_segment *lseg) { + if (!lseg) + return; + INIT_WORK(&lseg->pls_work, pnfs_put_lseg_async_work); schedule_work(&lseg->pls_work); }