Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp537449ybk; Wed, 13 May 2020 06:42:41 -0700 (PDT) X-Google-Smtp-Source: APiQypK4EnaRde3H2ZAaS3JVmB0qi3l7W/CxnsF1922i8xZIdj/HgdMz8vj2NSo0Pt0L6jLMWKLc X-Received: by 2002:aa7:dd84:: with SMTP id g4mr22983078edv.273.1589377361162; Wed, 13 May 2020 06:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589377361; cv=none; d=google.com; s=arc-20160816; b=LPfVuv75hXjM11V1Tp/YlNfz/XcxAMsrQ/9SrxE75mbtLHu9+TIVQkw5jmlv6uw32/ KBqtCVVqjXUZ7Tyvy53qQnZgWglv7AWaEQ8aCkyBtENx4XXh9PKGRpwfYDc9HNmlCNHB rTkksVcvKjcrlSkMS6XEVAo4I23KZxF9krY9MeNNTOwfcDUAvTIX0kyKUno/aWguqDnC pqQYYkKYvW6HwX4Gefm1tdteOAVY28JCJL61XXnk/q9GE5HPqMj4AhHw0K4yLeuhzBpc 4kb1SaAlbXMXP+YLNMUJTlBYvMRUbvMhk5GaMJQmV09fl3BQAXIc7ek1+121oK3qijkV Xp1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xyRGlbI4Ky3Dk3+EyeqNaJIIfLuLQ5HFlEzVPTO9nr4=; b=YA4+lc9H6F6HeqMZh8N7FzIvod0I1Voeyfmbe+COaox+aKrOsYbuzE9BIKiCTP/gEa 7i84RpDVaENUWgI4+eFFVI8PhHvIcPIvSQBVa7Cse/RsrNxXZ/oVqp9iuDNmPRC88KiF ZJQuj1BnKnCkfjvkMj3PFVfI5yLxaFFq+cu3bz6xj96C+fAyZnG4eS28LQrM5/VUw74f AvqJhCTVhb9Er2L8hK826pLNNp8YJipVL4/+ilvPO2i29GVmmPGaUli2H7GpskAdQoS4 Jz8qxxs/az+INesh5kFrToHAjHaGEN9ZCnNapa2M5So5EwzxAF73du5XsHTJPIruHUCc 6flA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=bMtNP9ht; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si10153440ejj.269.2020.05.13.06.42.18; Wed, 13 May 2020 06:42:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=bMtNP9ht; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388125AbgEMNjd (ORCPT + 99 others); Wed, 13 May 2020 09:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387966AbgEMNi7 (ORCPT ); Wed, 13 May 2020 09:38:59 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70616C061A0F for ; Wed, 13 May 2020 06:38:59 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id z72so18928062wmc.2 for ; Wed, 13 May 2020 06:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xyRGlbI4Ky3Dk3+EyeqNaJIIfLuLQ5HFlEzVPTO9nr4=; b=bMtNP9htiHa4g6CO0FhlyLgjdmVg2uoH/JS6A+XeeQjNSsWHJ8U8m0wdZGnw1Y+0aL kW8OYvE+eNBeWbbm/5Gab5wkT1yO1e6mIJUToNMcIPXRt7iTR0/vCIetz/nAJn27FLLz jhPPpIRzrjCO7NAduITv9ZIwigQhrw9Qrd7XSq6ZHbMgGPCG8DIfXLK4Mz26e6UyQIsC kFE/QS0MJpOZwOAHP/JmflUOLkHqqpPF2Ucefo9KzZkVgBFzOPS1UsPF3YxZe44yFlfI eGemUuSFNmHex8uVKB8LTn1f6/I4kJhidJrkgjKQ+bDuFwMnHX66Mv8lS/yNh7KxVHHy 5Qiw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=xyRGlbI4Ky3Dk3+EyeqNaJIIfLuLQ5HFlEzVPTO9nr4=; b=H29xdZXxmYCcimU978ceCG76/j/ILSB12Xjsb7Uw/GG7QrAuM3rDpuer64TdvPFt+I WZmBQvreDews2ZXS/ZSwb7tDunTSYyHNFVoJqEVWGGSNWjnujX1uTPzNCvBVHbvWiJQZ FmnwOSLgifmHiHLQU1FLtivvD3gP9lKM53x90JSnPuMyLYFF5u+DOkL+bVqd9aVkwFHF SDVsrdDZ2C2FH3rElm2ofRmRES8a2Xac+on5TluyMxILxhCJ3MUshpOkOwGEdNMrzFeD /g746F1Yza88N1imuAG9kQjKckEVpkccLdreogP/McZptdS2VA/b9S+WFA90jgEp6CUt N9EQ== X-Gm-Message-State: AGi0PuaU7WWC+DkFeN5De1ei1TreRFG0yXImuQ3MD2380mhky4JbgBVE NO/xN8kHRPLDS2XIajSsqPjVGQ== X-Received: by 2002:a1c:3581:: with SMTP id c123mr32473872wma.150.1589377130947; Wed, 13 May 2020 06:38:50 -0700 (PDT) Received: from maco2.ams.corp.google.com (a83-162-234-235.adsl.xs4all.nl. [83.162.234.235]) by smtp.gmail.com with ESMTPSA id m6sm26202653wrq.5.2020.05.13.06.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 06:38:50 -0700 (PDT) From: Martijn Coenen To: axboe@kernel.dk, hch@lst.de, ming.lei@redhat.com Cc: narayan@google.com, zezeozue@google.com, maco@google.com, kernel-team@android.com, bvanassche@acm.org, Chaitanya.Kulkarni@wdc.com, jaegeuk@kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Martijn Coenen , Bob Liu Subject: [PATCH v5 01/11] loop: Call loop_config_discard() only after new config is applied Date: Wed, 13 May 2020 15:38:35 +0200 Message-Id: <20200513133845.244903-2-maco@android.com> X-Mailer: git-send-email 2.26.2.645.ge9eca65c58-goog In-Reply-To: <20200513133845.244903-1-maco@android.com> References: <20200513133845.244903-1-maco@android.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org loop_set_status() calls loop_config_discard() to configure discard for the loop device; however, the discard configuration depends on whether the loop device uses encryption, and when we call it the encryption configuration has not been updated yet. Move the call down so we apply the correct discard configuration based on the new configuration. Reviewed-by: Christoph Hellwig Reviewed-by: Bob Liu Reviewed-by: Bart Van Assche Signed-off-by: Martijn Coenen --- drivers/block/loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index da693e6a834e..f1754262fc94 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1334,8 +1334,6 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) } } - loop_config_discard(lo); - memcpy(lo->lo_file_name, info->lo_file_name, LO_NAME_SIZE); memcpy(lo->lo_crypt_name, info->lo_crypt_name, LO_NAME_SIZE); lo->lo_file_name[LO_NAME_SIZE-1] = 0; @@ -1359,6 +1357,8 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) lo->lo_key_owner = uid; } + loop_config_discard(lo); + /* update dio if lo_offset or transfer is changed */ __loop_update_dio(lo, lo->use_dio); -- 2.26.2.645.ge9eca65c58-goog