Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp932188imm; Fri, 8 Jun 2018 07:28:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKISBIiYY9d4Rddi5zyt2NeOOioocQDh1xzwP78+M23ZwuglU7R/kbvJJdOLiO+7qNWkOW57 X-Received: by 2002:a65:6604:: with SMTP id w4-v6mr5538258pgv.346.1528468107275; Fri, 08 Jun 2018 07:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528468107; cv=none; d=google.com; s=arc-20160816; b=nj9PhfREJPeS45/RZ6DQiQx6YRKQnFuXYMxey2QC1u/N/UpP9Bd5g2v1prXAKuUnMH b/yWoRjYwMl5nXSFZBK+Wl2JUS657q5nB7Hqy9VzeNzUJVyx/0i55f1x5THu5z0dlA0R BE+N5kJXE7hd2P0+W4Nw2zJygrSxu7YjRgGFRtkGlb1lwFz4CdpSqz/JAZQHM83T5WAG S2gMOp55zr4gkbW/CM4Lz3xQWulnPYz+Hn45n+yd9ib1UefCzJAoSnrhGOHOHZ++kvhx Lo//xHY9FfVOKZNInFcggfOl36tUKh0UqqbAd69z6ahJKNw7/Ru+F/ZHePwVnqXHTvxg vC3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ijVt3ObzcJNZs1C3pOKoCqpAh5UEWTcKUeUj/GbA/Ik=; b=w+0POQDw3kHIDoUqhGijDCdhosbFrHqN0XFHV9lF4BdtqGKkp2k8TXNQfNM+htY2dv 8BN4CHbn4DzJUfdKARseADkJeZxHinM5P3UTqbpRlhiKl+I0yMSgJSzwLyfHmF3Z0YYK vKrllnVnS2TTXQL7Z+sGhKyBBdD2NrmiU7i8xRdPvJtTebLMJMJOBkE2sQ/x9eGe8ry2 XeT1YrDUjHqy1F+wXgD+//8nwZK9HvQeJyze2GSBwSKBZ47oUuFJH6wsV8eIb1fvP95q sITA7DvC0Qyt5jMwk1vCpnab/GbUQp6KQxqJNRsSl4x7i0pzeSoPrbKR+iA5kADX/qAD 1jrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=ISVi5RUb; 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=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i10-v6si9131682pgc.17.2018.06.08.07.28.12; Fri, 08 Jun 2018 07:28:27 -0700 (PDT) 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=@virtuozzo.com header.s=selector1 header.b=ISVi5RUb; 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=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752845AbeFHO1p (ORCPT + 99 others); Fri, 8 Jun 2018 10:27:45 -0400 Received: from mail-ve1eur01on0127.outbound.protection.outlook.com ([104.47.1.127]:3680 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751523AbeFHO1k (ORCPT ); Fri, 8 Jun 2018 10:27:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ijVt3ObzcJNZs1C3pOKoCqpAh5UEWTcKUeUj/GbA/Ik=; b=ISVi5RUbzDYm24ME61EJz0B0qMhAARlrRIWaV0cGlikOv38+vxXDGqIRvCZfmDXlfp6t/zQSrv+mRD/GKs6CqddC+2awZy0rgHYvjrNQXy4q29Cg9eoB6ne/FwaViBTbvjuqKaZ4UeFr7a2i7+b9mz+k9Ey0VJSp9MNN8dM+Lqo= Received: from finist_ce7.work (195.214.232.6) by VI1PR08MB3117.eurprd08.prod.outlook.com (2603:10a6:803:46::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.15; Fri, 8 Jun 2018 14:27:34 +0000 From: Konstantin Khorenko To: Kirill Gorkunov , Andrey Vagin , Benjamin Coddington , Jeff Layton , "J. Bruce Fields" , Alexander Viro Cc: Konstantin Khorenko , Vasily Averin , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] fs/lock: show locks taken by processes from another pidns Date: Fri, 8 Jun 2018 17:27:12 +0300 Message-Id: <20180608142712.32460-3-khorenko@virtuozzo.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180608142712.32460-1-khorenko@virtuozzo.com> References: <20180608142712.32460-1-khorenko@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR05CA0233.eurprd05.prod.outlook.com (2603:10a6:3:fa::33) To VI1PR08MB3117.eurprd08.prod.outlook.com (2603:10a6:803:46::22) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(2017052603328)(7153060)(7193020);SRVR:VI1PR08MB3117; X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB3117;3:9DCVyB/YqBY7LPMZgZn0cnlZbTAW1D5XfWQW06ElEB+wUnN/ngYtcwcpluqfWlo5tRh1tO3ANfbJqfHBchL6FogSk0l7nPUjYrg95COBLw6XgIlwQscuL88/0er65QkoX+sbx9UQLHWGvsJAoTbqTppb4nqBLwesAKjzor0lgurvyMc7oyc5SjHQ2jab+NJJ4uGM6IlsW5qzlvhZ29nKBqIvuJgMIGSi9Q+kEXO+jLoElbQtw+BPyiUyhWcidYxz;25:50Hy73MBY/hMQ25SyhL6/oWK7dTlh09pFdSKCg9UF7WlAnBqAvPUUmdceA/POM5wGHyojsU4OlBGpLlAd5GnqtvD60kiqEDsheUOFgqOckHsPiYsoGe8uoWTYlJtkmdCXsMyLODHOqplcElbLaHnnauWaFMZEmAKHpV43mXbgakX+aNNd6pXXphn6XS2TVQoGY249XJzwR6QA3pNK7E52kPJA35k95PfDV0gQBNKi12fil34IP+ydkV+R5wGJpwL62QKk4+4wTsuWy+KZSu0oFWWJvaKvekgA5BG3MgKitnF1BcAyMh48GBGcvUW0YcRHu8p4nQKzk+7H3kJWFLPSQ==;31:BLvoV5P/BBeNVk2lebPNG3/Dccu7/VcGq4fjqgfzJYT9I1hlbAhfbsEwFLmCYNekL6S03F5sNllnDtDjvW0IvOvC8dTJiAvP1n/Tjb1vIJO8TjUTSb9N2EDW+rPdmhhc8rCNN7fPkM3y5+qfZHCTq5eYDboTxf0ziHlVzwTmC6bYIpATZLoqFe3bKh8+Ye4WClGjNfoNOYoQmv8AfsRvdHiZX+BXXjHoHOcJ58P8pTg= X-MS-TrafficTypeDiagnostic: VI1PR08MB3117: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=khorenko@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB3117;20:YitkzLYnmrI+2CggdFPgPjPhrdsodkwplTS3BAG5JW56lxTFztFzAeJ5Qt1W2izpNocKOzydfDUyshP+QBRLL58Zed2NZ3gt6ixPF0+CpxfEAVDSCGocqUyVK/Bw89EiTGPZ3EleHRyiURKe2kmi3ZskTZjmOeRugUmFpu20K9yPB4Ro6srGo3TphF3fqNUJRCbvfxpaVovPELtkcxKKbf9rIFPdmg1MRGMkljpby2bPoRO9ZsFjez+bFkqJ+kh1h7cjeM+hOe48x+9EqdX3LOnPnfF70badFnEXquDZaEJMyulbs6sNyh+onFSfxKwYOjyt+xQUHYxvq2iQWMqAPd53nBBiw7o0WHwY4PmEO/hmbs059m3nJPVE/Urv3iOxE4r3fFlbsBPjAAJqPINo5G5cAsv+yQH/HYA4iDoqCFPtf5SVhu6QHnqfwqo7dNHpC7+sKqX3GO7rXCa0GgDNkiwSwcXb1C4VN6p26k/9OJcfdKLl6MoJPHkutXgt/x/M;4:QAG89qngoEHNxmBYQmib8p2BO4nUG+ck8fdjGy5M52D1MqUOqEHZkXtRg5y5G6eS4J8AzEcXbtXJzetrRfts1Jmtm4ISYwXS1qFlTYajme6OIXaFHVLRa5YROby/rw+gyoqkorzNa8doamW0Ii5e4dehD8IIaTkb/U+GUhmywQssNA5jFTKw8LocfMuaBWc4aom3CB+zZeC77bDNm40133+ENUaDbkLvfQAllPJeSuF6CuAFRk8QWSyzChnzDGhoT30ffur4nld/QUP8kFekPA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:VI1PR08MB3117;BCL:0;PCL:0;RULEID:;SRVR:VI1PR08MB3117; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(366004)(39380400002)(39850400004)(346002)(376002)(199004)(189003)(16526019)(52116002)(51416003)(3846002)(478600001)(1076002)(6116002)(69596002)(386003)(6506007)(66066001)(5660300001)(6512007)(25786009)(47776003)(36756003)(305945005)(8936002)(50226002)(956004)(76176011)(81156014)(8676002)(446003)(81166006)(59450400001)(476003)(48376002)(7736002)(2906002)(53936002)(11346002)(2616005)(68736007)(486006)(106356001)(86362001)(21086003)(6486002)(105586002)(50466002)(316002)(16586007)(26005)(4326008)(110136005)(54906003)(97736004)(6666003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR08MB3117;H:finist_ce7.work;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR08MB3117;23:Dibp5YHioOq6WTDYgWmaKag0BJLDw+C6NJ1ShSFrE?= =?us-ascii?Q?fxNta1A326PhK/i/7mse+KqDZbKMEt9AKr/mwXVqj32bP1VXv+3GiaHnaMH3?= =?us-ascii?Q?LFjt/dwuK8rxU+2shGQzmQeiNhWm+SdpJfioxJaiPEafza3YfYSRNqdTW7Ww?= =?us-ascii?Q?yXG8Jx7evuZCl9NhyVImR4HgFcBU0/z2IPEZjpJhxq3QW22p3NMHO8itqYQU?= =?us-ascii?Q?QiZaNBSbIWc3mBU86liNkh32GkmCXNzNfGGf6gADBmbYGHk6andaudR/AWk5?= =?us-ascii?Q?WI1Ya2s+b4ZF+DbPEksW3rHkCByJGMl/GCgB+pkE4gfKlSPtcrjY8zRnJaER?= =?us-ascii?Q?elRR08z0zMEKiTHxO4Sdnsx2PV4NmcdXfagSRY+stheeOHLSwaluLdx4Os1n?= =?us-ascii?Q?nnFHFVu6TsyRzLPE6Vg1IZvHKlMyUOVnSnp0PAy8GM/Rj5rSDBfHkV0yvxVW?= =?us-ascii?Q?rDw6x4dgfphK0dQ2bPG/ZsvNwhd0lEDFmWmjkJhFZf3hEfQmwP9FdKuH71/s?= =?us-ascii?Q?qTCoJ01ROxwoe7yBMlkMeeMxvHFXiipKZ0oEozmh2i9ikBVDO0Y/7bPH3nEV?= =?us-ascii?Q?iTFtD+DvShmJpOMre/QmnE0Zpy+/+tO8PDmuqXcfDd/8l6oGN8VPaA/l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Q;20:a/xE31H1BtFEPyKS0zkvyP63uMufXiBGxjTGnjVaBZm/z1wlTOTPLUbOpAo8Nf9xayZGFB2zPwL/6xFu/7UWhOXbXODNvEeVomx3oFu/i7zSPepI2fWHkbR1DtDkYW92cVP9ZFZxVub7ds7iXtDKVEQAxUm+d/SNfF5kMA3A97I= X-MS-Office365-Filtering-Correlation-Id: b71fe761-1f82-4054-ffec-08d5cd4bfac4 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 14:27:34.7782 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b71fe761-1f82-4054-ffec-08d5cd4bfac4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3117 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently if we face a lock taken by a process invisible in the current pidns we skip the lock completely, but this 1) makes the output not that nice (root@vz7)/: cat /proc/${PID_A2}/fdinfo/3 pos: 4 flags: 02100002 mnt_id: 257 lock: (root@vz7)/: 2) makes it more difficult to debug issues with leaked flocks if you get error on lock, but don't see any locks in /proc/$id/fdinfo/$file Let's show information about such locks again as previously, but show zero in the owner pid field. After the patch: =============== (root@vz7)/:cat /proc/${PID_A2}/fdinfo/3 pos: 4 flags: 02100002 mnt_id: 295 lock: 1: FLOCK ADVISORY WRITE 0 b6:f8a61:529946 0 EOF Fixes: 9d5b86ac13c5 ("fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks") Signed-off-by: Konstantin Khorenko --- fs/locks.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index bfee5b7f2862..e533623e2e99 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -2633,12 +2633,10 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, fl_pid = locks_translate_pid(fl, proc_pidns); /* - * If there isn't a fl_pid don't display who is waiting on - * the lock if we are called from locks_show, or if we are - * called from __show_fd_info - skip lock entirely + * If lock owner is dead (and pid is freed) or not visible in current + * pidns, zero is shown as a pid value. Check lock info from + * init_pid_ns to get saved lock pid value. */ - if (fl_pid == 0) - return; if (fl->fl_file != NULL) inode = locks_inode(fl->fl_file); -- 2.15.1