Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3903688ybv; Tue, 25 Feb 2020 09:20:55 -0800 (PST) X-Google-Smtp-Source: APXvYqz3UbmN+SpLldDjc2DzJSaUUXYP0qmBP9FUYTBvR+gqLXYUFPGIjeGeLZNQmNx+7n495R9Y X-Received: by 2002:aca:c256:: with SMTP id s83mr8651oif.57.1582651255360; Tue, 25 Feb 2020 09:20:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582651255; cv=none; d=google.com; s=arc-20160816; b=ItskqoAjisVISnwFA0QQaO/2xMn9vgHSIN0hRwIoj1J5H+dTfC8kYF2xBgq5c4DLPz L8VX6ntJXcmGks1ZsMEowDkt6ZMl/kqCk6YVVrun+K0+7+thjYcDinX+DSI8k5B6P2i/ KNC8HTEesfYLqS+elelIeKgkupuBP4cJ/o2hraMq+iTJB7DM+aN6zFx8Slul0UpqqUfe zSZatDqyYcjr+kd1uDCsE1t2OxWF92yNZNVt4PJBknzqMPt5jeG34NSU2ydZdVeaXrTS k3xHTsDKrqPwz8RNLLlIS8PX4oKLSHtlw0QqN9b4GhT1pqqI8ceca3W06z06iLH5Vhry 5UCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=P2GVz4Iq1B6C2YKd9O6ohn5EL9TclinOo1pocZp95IA=; b=s5YzI3+uQ3wnv3wcyFu8423fQQoA/KxYkgJjZQ7JKv9meeCMM5JZ/c6hhiycO9bd75 gVvgsJPH8rgIPSJdiFsJGVEC+QWzVHXlsd+prIEmlPGlB+KQFGQh2TNAfilt/9RQdhtS +iP0UbNlGhMKMGclMF4f3KF046T5ifdQiYspRi3a3xcEwwTrDSeBn4dDX5ipPvVJV8Ik pAgRGhbOYSPUlY+UDBABfYocJ0nIsQ1gIQS3e2p8St49iyDnLTMXNZffUtsODcy3KeJ+ ceuElDzpuSmWiDt8e1Qt1dyU3IXMuyjDVuZ9g4+rh1UUvP+F8z6xfTrF/UMIxzRiZKaE 8DQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="p8sCpfw/"; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 q5si8012678otc.104.2020.02.25.09.20.38; Tue, 25 Feb 2020 09:20:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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=@joelfernandes.org header.s=google header.b="p8sCpfw/"; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731111AbgBYRAb (ORCPT + 99 others); Tue, 25 Feb 2020 12:00:31 -0500 Received: from mail-il1-f194.google.com ([209.85.166.194]:42904 "EHLO mail-il1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728051AbgBYRAa (ORCPT ); Tue, 25 Feb 2020 12:00:30 -0500 Received: by mail-il1-f194.google.com with SMTP id x2so1938683ila.9 for ; Tue, 25 Feb 2020 09:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P2GVz4Iq1B6C2YKd9O6ohn5EL9TclinOo1pocZp95IA=; b=p8sCpfw/p08Lo6U8L+k6kM8USZ5CwWkLlPbgQaJjkLtcPsZh5NrA2Ps67flReYI/4n hghT+FQI+l58zAiMIn1MARUWuiSz9vVx/eiTzUZ8xYNj9EdH7vQ+KLhKjS9WuwLRHgm+ 2bzQT2Y5C/KFjjarX+YW+VcSviNGlI1SV6s9Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P2GVz4Iq1B6C2YKd9O6ohn5EL9TclinOo1pocZp95IA=; b=kIE0/23qSsuSe7AuJLSc5ghJ1LxUSrdT6t0SKsKvJr/j/usv+c0ioP6uZgBJjEw0MD Su3z8Dl8fxZQyOLR7pYcLMJsbMbJ88zfE4zXRqqphP4LlqtAVq3Fqknu2J72STkF9mZh y4qPh9WfsVXtC0pN+i7oMa5Vn/sQw4bC4CtikR/qiuA4Z7c9ngTutnA/nsKWODbOhzVU wo9mb3HBmWKDEKZGwzri3eMFfmWPyw34yZ2vV8bMGoH+uHyqHZe1H9DUCQ/BB9LNLAkI bxILy4dyPEdYd53d9HVwi326WYx1J3FNepZFvdQM+hcwTrAHcL7I/CpAynF4uYk/Jp2a diYw== X-Gm-Message-State: APjAAAX2w12w1tYo8pYTJQROJ50zr7W9/mraR2ZmAwnPoPsdVCWqc5zO soVvv45ssQAmzRLsZCAfRGehwKlM7HkzwbrsoGN+gg== X-Received: by 2002:a92:844b:: with SMTP id l72mr67233730ild.262.1582650029886; Tue, 25 Feb 2020 09:00:29 -0800 (PST) MIME-Version: 1.0 References: <20200220045233.GC476845@mit.edu> <20200221003035.GC2935@paulmck-ThinkPad-P72> <20200221131455.GA4904@pc636> <20200221202250.GK2935@paulmck-ThinkPad-P72> <20200222222415.GC191380@google.com> <20200223011018.GB2935@paulmck-ThinkPad-P72> <20200224174030.GA22138@pc636> <20200225020705.GA253171@google.com> <20200225035549.GU2935@paulmck-ThinkPad-P72> <20200225163826.GW2935@paulmck-ThinkPad-P72> In-Reply-To: <20200225163826.GW2935@paulmck-ThinkPad-P72> From: Joel Fernandes Date: Tue, 25 Feb 2020 12:00:19 -0500 Message-ID: Subject: Re: [PATCH RFC] ext4: fix potential race between online resizing and write operations To: "Paul E. McKenney" Cc: Uladzislau Rezki , "Theodore Y. Ts'o" , Ext4 Developers List , Suraj Jitindar Singh , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Feb 25, 2020 at 11:42 AM Paul E. McKenney wrote: > > On Tue, Feb 25, 2020 at 09:17:11AM -0500, Joel Fernandes wrote: > > On Mon, Feb 24, 2020 at 10:55 PM Paul E. McKenney wrote: > > [...] > > > > > As for "task_struct's rcu_read_lock_nesting". Will it be enough just > > > > > have a look at preempt_count of current process? If we have for example > > > > > nested rcu_read_locks: > > > > > > > > > > > > > > > rcu_read_lock() > > > > > rcu_read_lock() > > > > > rcu_read_lock() > > > > > > > > > > > > > > > the counter would be 3. > > > > > > > > No, because preempt_count is not incremented during rcu_read_lock(). RCU > > > > reader sections can be preempted, they just cannot goto sleep in a reader > > > > section (unless the kernel is RT). > > > > > > You are both right. > > > > > > Vlad is correct for CONFIG_PREEMPT=n and CONFIG_DEBUG_ATOMIC_SLEEP=y > > > and Joel is correct otherwise, give or take the possibility of other > > > late-breaking corner cases. ;-) > > > > Oh yes, but even for PREEMPT=n, rcu_read_lock() is just a NOOP for > > that configuration and doesn't really mess around with preempt_count > > if I recall :-D. (doesn't need to mess with preempt_count because > > being in kernel mode is non-preemptible for PREEMPT=n anyway). > > For PREEMPT=n, rcu_read_lock() is preempt_disable(), see the code > in include/linux/rcupdate.h. ;-) Paul.... ;-) ;-) thanks, - Joel