Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3494596img; Mon, 25 Mar 2019 11:25:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlgsP0EJhgDrNC/FKbUpg7Ah2gd0Ipuc0eJlxSNPKfuYWCHxPM9n3MlFQK79WvgD5VkYHx X-Received: by 2002:a62:ee0a:: with SMTP id e10mr7395927pfi.6.1553538315089; Mon, 25 Mar 2019 11:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553538315; cv=none; d=google.com; s=arc-20160816; b=f3ZUH+0iAoR3HH+UmGyHsXwsy/xPHdzfdvIJPSBQejsNOJj6JlLUnd6swlq63ezLn9 rHfK2sQQpRv4De1KqpkmAYti+mXYNdwdnWWzFSZ7GIMULkIOpfHgzH1f5GRr7PZnXNTa IAZ4XVf+zND4v07YNdeQSgEGTyVXrBejSQeLcSf7e2YJfvENmDJ/Gm27AdNW9XudSFty dZruF1GOxgA3T1oWy+t2ZaqB8NkIyJFrtXtXViLVUr45EFzY69IDJ4dpmdbguVGRh6na 1LSEW4l0JDEbp13XPMXnHbjZbABA8rTxL3PR7+UuaUV1jZHEH8qzF3dhwn0eB44fbvUk OXyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Fuerf2bI9t70P5LEgrUpoOfBjM1rTYvk8dbzFX1K27M=; b=dWWBXNmU02KRtLqMl2DiXt+rMaYF25hujJb5L0V2VmmkBkgSVoSLe2gH9dzD54gYyE ZLlF0ZcPC8xmaT2bNXSAofXI39NqDkm10d4zyfKs1v8lS9BEJy8IjRt+fo4j/LpuRPPW GsgsVU+fNe86zwEwk2n/NT+lNNfED2vM2kP7JhSCksYvLOJLuTkERwUU7PWRzpeuaJoZ Ch4vS3h9B+F+IzW0srC/ETVW3Vfa1c6d1bdji/rdZ0/O94hxPboFbp0TIx6D6/RZDWQ+ t0nawDlQ1uT6gDdRVYeATCTEy1iCwG0bTXEyxUttvW65HD2TpjnuXV7UX+yyy4bQ2VOH cypA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digidescorp.com header.s=google header.b=TNVtqdyh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si13093452pfw.6.2019.03.25.11.25.00; Mon, 25 Mar 2019 11:25:15 -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=@digidescorp.com header.s=google header.b=TNVtqdyh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730069AbfCYSX7 (ORCPT + 99 others); Mon, 25 Mar 2019 14:23:59 -0400 Received: from mail-io1-f53.google.com ([209.85.166.53]:43453 "EHLO mail-io1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728912AbfCYSX7 (ORCPT ); Mon, 25 Mar 2019 14:23:59 -0400 Received: by mail-io1-f53.google.com with SMTP id x3so8472839iol.10 for ; Mon, 25 Mar 2019 11:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digidescorp.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Fuerf2bI9t70P5LEgrUpoOfBjM1rTYvk8dbzFX1K27M=; b=TNVtqdyhoYvyciWJujGPznE0tDkGTaw3rzj6pOY9cyuYEhZBSxx9ctDl2IwJbhKaxQ HI9qsGKNLwC2FxJeUgSqjlCJTJihzUhLCTP+MVbxXPeHJUDf7v325aYJrssrDB6rm7vD gCD1xS9crtbHGkPPsQdEcNIton7+4LhbUhQuE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Fuerf2bI9t70P5LEgrUpoOfBjM1rTYvk8dbzFX1K27M=; b=Jymc58asxmVfJ7AUCHhR4OWnpBpG1Y4nOkzsBJzFVAmpSpr7ucLUAW6dMNT96pPF0R Y7Cb8CsdpeWE2N15bPqih3L7YIhRGX99JyCdZnSb1jJU1deU0XR/40CP2sO4rxxCfNY1 74mYETg0FhoV4wzxMXIsL/S/fqATJPU/J3S4p2qOghWygVtXFJjLA+JXc9Y+22AmYjLJ lWoa3zzcLCd1YAxW31ZSaPP93t7DqLhphXQoUMHcGWwYATn6z4Xd5uJ+Nn7bZ4jCZoey JuNOljZFJS9AXO72RnKHs/2zadOfBVXHlsgIwX6Vgxji9FHH2U5V8zJJlG0xK36FDk6d BvRA== X-Gm-Message-State: APjAAAUKPlJTwkHLLhzMfPK8R5f+W/D4nmXwGTIkDhH9eEDkgMLPMxVk lHkXUlDwVGXLzu90UUL2ND1G1g== X-Received: by 2002:a5d:8918:: with SMTP id b24mr19078073ion.241.1553538238599; Mon, 25 Mar 2019 11:23:58 -0700 (PDT) Received: from [10.10.7.164] ([50.73.98.161]) by smtp.googlemail.com with ESMTPSA id v133sm385601ita.2.2019.03.25.11.23.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 11:23:58 -0700 (PDT) Subject: Re: Possible UDF locking error? To: Jan Kara Cc: "linux-kernel@vger.kernel.org" , linux-fsdevel@vger.kernel.org References: <224e1613-b080-bd64-ef88-badcb755a233@digidescorp.com> <20190325164211.GF8308@quack2.suse.cz> From: Steve Magnani Message-ID: <35961291-197a-0557-ff81-dc8686dd8661@digidescorp.com> Date: Mon, 25 Mar 2019 13:23:57 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190325164211.GF8308@quack2.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/25/19 11:42 AM, Jan Kara wrote: > Hi! > > On Sat 23-03-19 15:14:05, Steve Magnani wrote: >> ... >> >> In contrast, udf_setup_indirect_aext(), which constructs an AED, >> has this sequence: >> >> bh = udf_tgetblk(...); // calls sb_getblk() >> lock_buffer(bh); >> memset(bh->b_data, 0, inode->i_sb->s_blocksize); >> >> set_buffer_uptodate(bh); >> unlock_buffer(bh); >> mark_buffer_dirty_inode(bh); >> >> // other code to populate AED data in the block >> >> In this case the population of the block occurs without >> the protection of the lock. >> >> Because the block has been marked dirty, does this mean that >> writeback could occur at any point during population? > Yes. Thanks for noticing this! > >> There is one path through udf_setup_indirect_aext() where >> mark_buffer_dirty_inode() gets called again after population is >> complete, which I suppose could heal a partial writeout, but there is >> also another path in which the buffer does not get marked dirty again. > Generally, we add new extents to the created indirect extent which dirties > the buffer and that should fix the problem. But you are definitely right > that the code is suspicious and should be fixed. Will you send a patch? > > Honza Sure. There's at least one other place where it looked like there might be a similar issue. Steve