From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: ARC-Seal: i=1; a=rsa-sha256; t=1516999536; cv=none; d=google.com; s=arc-20160816; b=tl91+F2/YTech1bmu++qydILovD11xHRq5sdFqiJJPT4gUt0KCoIIfNi6cKS3aIQEk AkISmGMW8PmOSPFl1HyjAR/kUVRAmngZoLHN4ehEI/K8q29AZv3ibJ79UKLPacT3Zrsb MvsT04TzxWot7gZpCbUxjGQ/0RY7D1rpb9wRsNmf4X5QYhsjyv3Nk6kxK15CO5aqmDiM 8FsS0OuFS1hHVFCgSOxeTF/OkPxpHI0NVN9Me2ONcAaE0SnAi2VNTmh6AeV8AFmwQP9r zSqFBH0slNlWCAhI5eH2ikgo9jZ0WWsZcDZxurrII0UYf0YEa8/TdQ8b3c73k2Xn9oUb U1Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:dkim-signature:arc-authentication-results; bh=xCCySqpV3gI2Kk6Y1gi5hlsgzMMUn/J79dfElo6SqNE=; b=mErHIRpWZdeP7Ijd5J9gn4ZhsWt5i8FMMgQj9wNegtja/AbLZis7wFD1KosZrGAr2A kXGhORvOdzZOc4+NSFK9dFy3DLGp0Qe6yEk407PO07YVWvfxmvoXCtnjwcTWj+bybgUL nACmAheQLJ1OZFlG+GB0CxYXWH5sZVgN0fS/vmG2gKuWy8C8eFla+jgcVww4LN5i8u0P UrjyeqOYUGfkE7NieQWmXUUPaclmPTdF9b6jjzZneMabrFJV6W1GKJgs8UYjhdgv6tgf kk/LobsW4DdiwvSL+A1Jl5uT2wCzZscuZtQn5SEuvJ8bO5y3A/Jenfnc6zNjXHTv7lj3 W63w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Q9CVkGnH; spf=pass (google.com: domain of joelaf@google.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=joelaf@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Q9CVkGnH; spf=pass (google.com: domain of joelaf@google.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=joelaf@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Google-Smtp-Source: AH8x2244/d3qL5qgCLnu8fVpnxXlbcwp5WHW+8nA2L1ELsaLSb9Va72yINrQ+pJauamEAklg04HPxiHsaxBL/P3W/bs= MIME-Version: 1.0 In-Reply-To: <20180126193954.GB13338@ZenIV.linux.org.uk> References: <20180126024649.200330-1-joelaf@google.com> <20180126031346.GW13338@ZenIV.linux.org.uk> <20180126193954.GB13338@ZenIV.linux.org.uk> From: Joel Fernandes Date: Fri, 26 Jan 2018 12:45:34 -0800 Message-ID: Subject: Re: [PATCH] ashmem: Fix lockdep issue during llseek To: Al Viro Cc: LKML , Todd Kjos , Arve Hjonnevag , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590621447299099171?= X-GMAIL-MSGID: =?utf-8?q?1590689305230392776?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: Hi Al, On Fri, Jan 26, 2018 at 11:39 AM, Al Viro wrote: [..] > >> But one usecase for the mutex is with concurrent lseeks, you can end >> up with a file->f_pos that is different from the latest update to >> asma->file->f_pos. A barrier could fix this it too though. Any >> thoughts? > > lseek(2) is serialized against lseek(2) and read(2) on the same struct > file - see fdget_pos() for details. Ah right, Ok. Thanks. > ashmem_mutex really does look like an overkill - something much lighter > should serve just fine... There's also the issue of asma->size getting updated from while being in read ashmem_llseek (although this is a theoretical concern): if (asma->size == 0) { ret = -EINVAL; goto out; } Which could just use READ_ONCE and WRITE_ONCE instead of the mutex I suppose? Other than that, I don't see any other issues at the moment with dropping of the ashmem_mutex from ashmem_llseek. thanks, - Joel