From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03F7FC43603 for ; Fri, 20 Dec 2019 16:46:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC87420716 for ; Fri, 20 Dec 2019 16:46:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="gfWcV0ui" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727362AbfLTQqg (ORCPT ); Fri, 20 Dec 2019 11:46:36 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:54284 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727181AbfLTQqg (ORCPT ); Fri, 20 Dec 2019 11:46:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wBzPcwiacPh3r6JPPuX4OW3YmJm5b2HBjhLdhW1rrhw=; b=gfWcV0uibA4PFU/4rEbLjxkz5 MG8MgU55g11y3RIPF3OV3lH6YW6USCsaChSawFavqS03tMJMxbhzQNlUQ4LgBM9czPB2o1NXRqGzJ xsH8yvHWtPIOTxC6G6W+Jmdt6A9gU8VEl9ZXqU2Zk7tOSIFqT2E6eZPwtwbKfL99uKVOivoX5YxWC uWdNcE7sHIvr6yJ50gf/nC2wpbqxAQtaE2GWRlpCZVVwm5d1HL4yjArHFf0xmMzdldrHMNNn3Qjj1 OlTvms47JyJWNXCalo/YyzycxUlGS6VJ7DNLoSG6TsfGfZYvdXWJ/lThq4jLxjN3auQzvcE9ac5kf dbwLX4f3w==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiLQ8-0001ik-7Q; Fri, 20 Dec 2019 16:46:32 +0000 Date: Fri, 20 Dec 2019 08:46:32 -0800 From: Matthew Wilcox To: Amir Goldstein Cc: Chris Down , linux-fsdevel , Al Viro , Jeff Layton , Johannes Weiner , Tejun Heo , linux-kernel , kernel-team@fb.com, Hugh Dickins , Miklos Szeredi , "zhengbin (A)" Subject: Re: [PATCH] fs: inode: Reduce volatile inode wraparound risk when ino_t is 64 bit Message-ID: <20191220164632.GA26902@bombadil.infradead.org> References: <20191220024936.GA380394@chrisdown.name> <20191220121615.GB388018@chrisdown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Dec 20, 2019 at 03:41:11PM +0200, Amir Goldstein wrote: > Suggestion: > 1. Extend the kmem_cache API to let the ctor() know if it is > initializing an object > for the first time (new page) or recycling an object. Uh, what? The ctor is _only_ called when new pages are allocated. Part of the contract with the slab user is that objects are returned to the slab in an initialised state. > 2. Let shmem_init_inode retain the value of i_ino of recycled shmem_inode_info > objects > 3. i_ino is initialized with get_next_ino() only in case it it zero > > Alternatively to 1., if simpler to implement and acceptable by slab developers: > 1.b. remove the assertion from cache_grow_begin()/new_slab_objects(): > WARN_ON_ONCE(s->ctor && (flags & __GFP_ZERO)); > and pass __GFP_ZERO in shmem_alloc_inode() WTF would that _mean_? I want this object to contain zeroes and whatever the constructor sets it to. WHich one wins?