Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp483769ybl; Fri, 6 Dec 2019 00:56:48 -0800 (PST) X-Google-Smtp-Source: APXvYqy4Q2fsRnTrZzWkeSGjieLFbNrxfu56XlgZmGFJCxgrut5lmCBzPA2RAdPOqnZkVp6YEtq2 X-Received: by 2002:a9d:5612:: with SMTP id e18mr10400346oti.183.1575622607850; Fri, 06 Dec 2019 00:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575622607; cv=none; d=google.com; s=arc-20160816; b=AolzdxkxeaSRIm5A/AEZJwG5qM6rot6uJIvuu65sG9FYVtu0MY1y+QB+BcoUYuqaoA HxKmkGlhcaYaOUEvjO3W23ZxlzgMWSBfyps4CeXSe/xoB93BEJsAG2OQrk90w5VOr2so jBAZtpd1W8MOfSbmhcTyoAg4I/N7Ds6c0E1b2Ebr2WSrl4bhVl85TlV40mOQDDzsgapq OOD87nyhviOhZonk1dawVERlIOHYcAsi0ddxGZoGsx8+Q6jWFI201YA/mwOp5H5g1DvC Za3s+MeLnf7oPb0Mbu0hBRewcmwWEv2KB9iJlu1gCSUvmyuJXz8oWgLk4JMFSToi9B6X sCCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=9koV2GOa9gLGpNjBXrPkm6jAgXDZ7fPOfYz+Zz14/JY=; b=MRX0DGFUvrfpk2+B97tLEtldDUTdZ2KeL2sBsd6innMhKazLef7yKPRX1DZzs1/3ko E6TuRDPHC30SkxHpuCyc5m2ox9IZtNk3iJfUk4Qw3RNvx4xsyJLEeW265sT8EKYBk+li pn96gOnQ9Ks/JfMe882C4iioia7jPJ8BXPbXly1cmhusi9YOjp6c+elzOW0QNEkHT94w O4FKT6fOjA5Xuo3GP3UuNu4Qlb+MPqBvoeNMUVhnudpI/dyxK/05P9sD5sJq7ZrwxHaB dUEwQPL2khwcgom80yPMvVxwRwxFW64Pkh5CYy997RweCuf2BwPI91AvJwujdr3kNpR+ WTng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Nl2bmJtI; 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 188si6938941oig.197.2019.12.06.00.56.35; Fri, 06 Dec 2019 00:56:47 -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=Nl2bmJtI; 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 S1726298AbfLFI4D (ORCPT + 99 others); Fri, 6 Dec 2019 03:56:03 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41543 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfLFI4D (ORCPT ); Fri, 6 Dec 2019 03:56:03 -0500 Received: by mail-pg1-f193.google.com with SMTP id x8so2984103pgk.8; Fri, 06 Dec 2019 00:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9koV2GOa9gLGpNjBXrPkm6jAgXDZ7fPOfYz+Zz14/JY=; b=Nl2bmJtIJtm7g/qfRfP2sMux0HRYnpB1a4dCOqegUu1/NefVCr+qpKLgBZw/0hfbg9 oPxVst0rB161729WTf6M0Cx7/jaTQBbWGqD/br1FvXjCgRmw3ZD8Wmf9VR83gEN8wUDF 7mGhTr9BRW6GAzD4KiBHoDIvV6hDZk7gssM7HWRZNAsH4z+ckroDPELf+LgoiLcHBVnh A+4of2uXALnDzAL2V78zHBP5QFBulJJT5sKoulDXbfZh2oVZRQSu1k5NYTO8qEHfIPad am/RH2R6XRyc11cJvuy/O+Pz+/SGTHwb0xyKMLahOseX9wJ0XiZDoD4Q59Q93MwhB5Mp 4YBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9koV2GOa9gLGpNjBXrPkm6jAgXDZ7fPOfYz+Zz14/JY=; b=aXoOyMvlXHwSWmvbIeiKBhh2zsZox+cKo3kv1slCH2++xz0d/Z2m+3YS9LkTZgP07M Hh7i+IbLE97QZUCBNlw0Qst6qGykzvMF6wEixE/uUxNIEcMYiXealXATPLaZOq0y2XMy SVlDCVwpaeInRLVPY+4KgsvcoDl7jC0xHzEEdid08iK7rNKOJtIuWCd8VzWb3dUrkb2m OFq7tIpNiUeQrwibIDk4SHN3u1i/LnDElhhQRLXvTjWwBsP1M5FQXbHTiWoHzEPAsGRr NOfqAGK03/DGBLWIYQP2h5aC6S50DkW9ZzFMevcNooqhYsTNA7lnI1TwX1Npl8NKSUPT wRQQ== X-Gm-Message-State: APjAAAWZiXj7QvwQ4Lv1h+o8X/g+SyBbw9asvFc5dvEpAMCA4aHEkjaR RtPwO5x4+P6pL+R9BFJXZ8Y= X-Received: by 2002:a63:d24b:: with SMTP id t11mr2275806pgi.414.1575622562555; Fri, 06 Dec 2019 00:56:02 -0800 (PST) Received: from workstation.localdomain ([170.178.178.163]) by smtp.gmail.com with ESMTPSA id u18sm14520599pgi.44.2019.12.06.00.56.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Dec 2019 00:56:02 -0800 (PST) From: Liang Chen To: colyli@suse.de Cc: kent.overstreet@gmail.com, linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, Liang Chen Subject: [PATCH 1/2] [PATCH] bcache: cached_dev_free needs to put the sb page Date: Fri, 6 Dec 2019 16:55:42 +0800 Message-Id: <1575622543-22470-1-git-send-email-liangchen.linux@gmail.com> X-Mailer: git-send-email 2.7.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Same as cache device, the buffer page needs to be put while freeing cached_dev. Otherwise a page would be leaked every time a cached_dev is stopped. Signed-off-by: Liang Chen --- drivers/md/bcache/super.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 77e9869345e7..a573ce1d85aa 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1275,6 +1275,9 @@ static void cached_dev_free(struct closure *cl) mutex_unlock(&bch_register_lock); + if (dc->sb_bio.bi_inline_vecs[0].bv_page) + put_page(bio_first_page_all(&dc->sb_bio)); + if (!IS_ERR_OR_NULL(dc->bdev)) blkdev_put(dc->bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); -- 2.17.0