From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752132AbdCIG53 (ORCPT ); Thu, 9 Mar 2017 01:57:29 -0500 Received: from mga05.intel.com ([192.55.52.43]:39004 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751651AbdCIG50 (ORCPT ); Thu, 9 Mar 2017 01:57:26 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,267,1486454400"; d="scan'208";a="74568703" From: "Reshetova, Elena" To: Kees Cook , Christoph Hellwig CC: "darrick.wong@oracle.com" , LKML , "linux-xfs@vger.kernel.org" , Hans Liljestrand , "David Windsor" Subject: RE: [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t Thread-Topic: [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t Thread-Index: AQHSl+mTtpkfs97PAkqAkdARPIHlq6GLF7yAgABHe4CAALUD0A== Date: Thu, 9 Mar 2017 06:57:07 +0000 Message-ID: <2236FBA76BA1254E88B949DDB74E612B41C569A2@IRSMSX102.ger.corp.intel.com> References: <1488963219-11709-1-git-send-email-elena.reshetova@intel.com> <1488963219-11709-4-git-send-email-elena.reshetova@intel.com> <20170308155059.GA4353@infradead.org> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v296vWfA027914 > On Wed, Mar 8, 2017 at 7:50 AM, Christoph Hellwig wrote: > >> - ASSERT(atomic_read(&ticket->t_ref) > 0); > >> - atomic_inc(&ticket->t_ref); > >> + ASSERT(refcount_read(&ticket->t_ref) > 0); > >> + refcount_inc(&ticket->t_ref); > > > > With strict refcount semantics refcount_inc should check that > > the count is larger than 0, otherwise we'd need to use > > recount_inc_not_zero or whatever you're going to call it. > > > > Is that something the recount code does / could do? > > Yes, refcount_inc() will not increment from 0 and WARNs. It looks like > xfs's ASSERT is also a warn (though with XFS-specific formatting), so > perhaps the ASSERT could be dropped? IIUC, Elena's approach to these > changes was to be conservative about removing the existing checks. I am removing the existing WARNs now where they are 100% not needed, but leaving the ones like this ASSERT, because I am thinking that you might have test cases that are dependent on these ASSERTs with specific formatting and I don't want to break them. If you don't need them, I can remove them also. Best Regards, Elena > > -Kees > > -- > Kees Cook > Pixel Security