From patchwork Wed Feb 21 12:32:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 876061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="petVvFfH"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cBCnmhDu"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zmcNL6RRpz9sW1 for ; Wed, 21 Feb 2018 23:33:38 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=yl5ZmQLA+oka9EAy4PBSF+/7zFacikRBqxYm9dXga0Y=; b=petVvFfHBa7EGx 6IOA5U6FBkrAbcGhbN9x+Zs3K6vtVoQDgUK3coY7LdaIYZ7qjxfRH+afYpwmGtwZKE1v7bPLoHKJa PAObbiMdf7xr9qMsnIwsXnLJcxgNVWe5yUOz7gwTDr6BJBS2tKl1kbdH1JUVhes49uxeDDSSwS+B6 9HspeScM6flC1EXLsoE3OwweCpfGFO2vOf4KiV9J9xmjZ/2G2DrL5G1dHNkZ4Z949XxyHWgQgMPU0 OAcdtN1UFj1mmGErSikVX56s1yIHzGaq0z6md2hhxZwWvQxVdqj3Woaz1QyAd7j9TylF8AUqlVD0W i/8HNJq4M52uwyaM0iZQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eoTaH-00080a-To; Wed, 21 Feb 2018 12:33:17 +0000 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eoTZg-0007n5-Iw for lede-dev@lists.infradead.org; Wed, 21 Feb 2018 12:32:43 +0000 Received: by mail-lf0-x243.google.com with SMTP id t204so2107519lff.9 for ; Wed, 21 Feb 2018 04:32:29 -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:mime-version :content-transfer-encoding; bh=TBuv9KSFUAJxQGvMFyWkq0SgaLlhiN4dqq/Cp8u7sRQ=; b=cBCnmhDuQKchHapuqR9NuTnqOR09XPaLXFTGwEZFoEXUI0YEhnc1bJ5mtMt+jm73Xl oW7dLB6KjJQaMiSTtR9Spl7AAsewyeEqtrsZzZnvDru0yx1kU9kwiGbtmX24bxHLr+zb WRWP1uwbLx7oYAv8bMY0fZ2vAOkP+KJsw4qQ/j5iou8jZchMVTFoNJm6PjgxW3y2OlIx avlKbU+Ord7K4V8J+AWRjt91l3mrU8s74FnTp0nruN62t5lw1NXL9KTTiRDTEc+Fpyr+ McN+nTiLrePj6599rrCs1JE7EyprTO7W8wuhufdWElAOIT43CQiBI7lrGOp5psaobpip 3cLQ== 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:mime-version :content-transfer-encoding; bh=TBuv9KSFUAJxQGvMFyWkq0SgaLlhiN4dqq/Cp8u7sRQ=; b=NaagAA7tk0BvhdqypNDtNNrfnaFE1wNSQ/WXDFFT5eaRXd+3bE5rXSbP996oxV8k+P dFuNtpKIWdAeox9Vu5pfBYIcGI5h0v0Whck4yCF8j9Ia9lCyBtvTRZuyoIIUEIF2GNWc iLvY6zF4Tuk4PX/WtaGDtM3W0vgjd0Lw6IhHeTBmFFdmwv2yHJxk5eD4AHQ4c4NMj26I NWHV1tuLCHCvF64BSi1aWWXfjuMXcap40rcxLzb1N3daPQhqqwXS1UH3h6eYEujFzRtA SrEGLAWk5UpfaONWhz7YhugzHxLDSlM26ONjB5mpMIm6EMPEvTamrzW/auzgK5Pqqu0C SPUg== X-Gm-Message-State: APf1xPAmu1DC92nyhRgD/6Jzve2ZIXA7AGjU4BcIrNJuDjZiYG5WVdfJ FtET+F9v2mORsQ7ZGl3G5TU= X-Google-Smtp-Source: AH8x224TZEFRTVUWM3WG5w0khg/FwoVaSooVEdKMk2fkcxDGRrlPkOkQYWhDff13TUArfJd1XmBj9Q== X-Received: by 10.46.87.72 with SMTP id r8mr2308344ljd.93.1519216348279; Wed, 21 Feb 2018 04:32:28 -0800 (PST) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id h16sm1736551lji.72.2018.02.21.04.32.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 04:32:27 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: John Crispin , Jo-Philipp Wich , lede-dev@lists.infradead.org Date: Wed, 21 Feb 2018 13:32:16 +0100 Message-Id: <20180221123217.28211-1-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180221_043240_738437_6E5BB443 X-CRM114-Status: GOOD ( 12.65 ) X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4010:c07:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (zajec5[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zajec5[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [LEDE-DEV] [PATCH mountd 1/2] mount: try lazy unmount if normal one fails X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Rafał Miłecki If umount calls fails (e.g. because of some application accessing old path) the only chance of getting mount entry cleaned is receiving autofs expire packet. This isn't fully reliable: 1) Sometimes expire can happen before closing all handles. In such case a second unmount try will fail as well and there won't be a next one. 2) Expire happens after specified timeout. If device reappears quickly (e.g. due to being replugged or USB controller restart) it may be worth having old mount cleaned up earlier for better user experience. This problem can be easily handled by using MNT_DETACH (lazy) umount as a fallback. Signed-off-by: Rafał Miłecki --- mount.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mount.c b/mount.c index ddcd5b3..3994149 100644 --- a/mount.c +++ b/mount.c @@ -604,6 +604,7 @@ static int mount_dev_del(struct mount *mount) log_printf("device %s has disappeared ... unmounting %s\n", mount->dev, tmp); if (umount(tmp)) { err = -errno; + umount2(tmp, MNT_DETACH); } rmdir(tmp); mount_dump_uci_state(); From patchwork Wed Feb 21 12:32:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 876062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Tbe63ck2"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kbQjmIOs"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zmcNl3B6dz9sW0 for ; Wed, 21 Feb 2018 23:33:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pnxpghENuxrwt9KtN0V30/603GiHe2DtKd80esnvrkk=; b=Tbe63ck2w+QmRT mEQ3FnuzR6m+axmK6tDzqK88Xzdv+tD7PZjpYdRtQUrYQBP5WaxyIyGhEz1P5v9mGx3bU78kg96+6 xEkN0rWa4QF8vj0gsW7nzMbnKffc07se5hxOtrxYlTrgN9PLqhO+JVLmc/kJrCDebxUX19GRO9Ki2 kJX5s+IgUUqi/yVXEx1Embg79Kwf4RYm7KsOsyVm+DtTyo/OOugeK/C4ldswcKKdiuYKo2I++t1qu 53UY8H2nVBC9EPP0UZ/5YQPcvAWr42ntDgYd07+ILgiuxrDWAtLgLzmbqOuuTrc+BDhgvFmy8SMmL eUFl6UnMV6vu8W6n1bEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eoTal-0008Gk-2u; Wed, 21 Feb 2018 12:33:47 +0000 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eoTZg-0007n6-Iu for lede-dev@lists.infradead.org; Wed, 21 Feb 2018 12:32:44 +0000 Received: by mail-lf0-x243.google.com with SMTP id t79so2120555lfe.3 for ; Wed, 21 Feb 2018 04:32:31 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=S7XoTEu0p/MIyITdu8JJKBIQwoqoLCOeXk8/lrnFuIA=; b=kbQjmIOsNBKKaZOiICTHH1nMR4t4Zxz/nzyFH7XXGsFNnLCwBpFIup6hH95I44DelJ 3NaWFIVBNsstR15gsHlR1LHgOxoR80U9BBMU0L9mtqZit7UxHOgTGNLE3XVPGtPcONye QYpSowsOGqNwvs2HrrfwoPNUbSAMvhCuEdpag6X+DyjCS5JSurRt4jyAmZf7Csb4J6W6 sPi5TGsojiBLSKHaaGJVJhr6bFL22H49/f4+BTPROID1nb4TaMPg/kGHFnPW1ASqYW+Y W+RH8mpbfTcy4G9JX2jG2Y/EleLSHAfBr+eLKLqsQJ9ByZtkuYx6qp/QyHDeEsLYmM5l fN3w== 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=S7XoTEu0p/MIyITdu8JJKBIQwoqoLCOeXk8/lrnFuIA=; b=kB3OEJwgtKMYEddr95VOZZogYvAnPkUuJiGIQCeh+f4IUv80p5AaMOiy2duEayYzFm rdIS0JBbSQYognQ9xKcw+MnDZJAFHMIcRWDbHOTAhQ47YBXSfdhcdIjUjnxrutXJ9kkp ZnQjRvrRpBpv/y8yShFv6w1pKelvfG1Q9kq/BXWcRp4u/TY/YorU3L3/g9CT18LS/eTW VhOwQRbfMWBD7IcN5SSu19fSL4QHAtfaqotzqBIbcNmQrcxEDImLGVTW1MAe1qCXJGJM wfUR6sYerQjUoY0Q87x1afJsnMJIrdUPeS2lc6FlWX0WKRDkhFTXsfidqpW+Jif+AvMO cihA== X-Gm-Message-State: APf1xPA4DC1ZKzQ1mNjKZflF3jWKlaZqHLWj5c+Wt7XQB/Kj/QsJPNWN jG73I7bBrnUxPMG5eoP/L6k= X-Google-Smtp-Source: AH8x227nKvffBSV8phwg2wDWRej7BTb68JlepEJqnEVJYqugw3f1I5CCmTTqcYYfCX6iHzHDvx0Pvw== X-Received: by 10.46.13.10 with SMTP id 10mr2448452ljn.8.1519216350115; Wed, 21 Feb 2018 04:32:30 -0800 (PST) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id h16sm1736551lji.72.2018.02.21.04.32.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 04:32:29 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: John Crispin , Jo-Philipp Wich , lede-dev@lists.infradead.org Date: Wed, 21 Feb 2018 13:32:17 +0100 Message-Id: <20180221123217.28211-2-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180221123217.28211-1-zajec5@gmail.com> References: <20180221123217.28211-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180221_043240_722650_7479CB03 X-CRM114-Status: GOOD ( 12.19 ) X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4010:c07:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (zajec5[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zajec5[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [LEDE-DEV] [PATCH mountd 2/2] mount: call hotplug-call with ACTION=remove before trying to unmount X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Rafał Miłecki This increases a chance of successfully unmounting a drive as calling hotplug.d scripts may result in stopping applications using it. Signed-off-by: Rafał Miłecki --- mount.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mount.c b/mount.c index 3994149..00fe91d 100644 --- a/mount.c +++ b/mount.c @@ -774,11 +774,13 @@ static void mount_enum_drives(void) } if(!check_block(q->dev)||del) { - int err; - - err = mount_dev_del(q); if (q->status == STATUS_MOUNTED || q->status == STATUS_EXPIRED) { char dev_link[64]; + int err; + + system_printf("ACTION=remove DEVICE=%s NAME=%s /sbin/hotplug-call mount", q->dev, q->name); + + err = mount_dev_del(q); snprintf(dev_link, sizeof(dev_link), "%s%s", uci_path, q->name); if (err == -EBUSY) { @@ -792,7 +794,6 @@ static void mount_enum_drives(void) log_printf("unlinking %s\n", dev_link); unlink(dev_link); } - system_printf("ACTION=remove DEVICE=%s NAME=%s /sbin/hotplug-call mount", q->dev, q->name); } p->prev->next = p->next;