Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752165AbcKGEKT (ORCPT ); Sun, 6 Nov 2016 23:10:19 -0500 Received: from casper.infradead.org ([85.118.1.10]:59242 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751596AbcKGEKS (ORCPT ); Sun, 6 Nov 2016 23:10:18 -0500 Date: Mon, 7 Nov 2016 04:10:16 +0000 (GMT) From: James Simmons To: Oleg Drokin cc: Christophe JAILLET , andreas.dilger@intel.com, gregkh@linuxfoundation.org, emoly.liu@intel.com, lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH 2/2] staging: lustre: obdclass: Add handling of error returned by lustre_cfg_new In-Reply-To: <97207CF4-21C1-4351-92BF-6F28E7281CF6@intel.com> Message-ID: References: <20161106171123.24929-1-christophe.jaillet@wanadoo.fr> <97207CF4-21C1-4351-92BF-6F28E7281CF6@intel.com> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161107_041016_269543_61C6FE4F X-CRM114-Status: GOOD ( 14.82 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1080 Lines: 21 > On Nov 6, 2016, at 12:11 PM, Christophe JAILLET wrote: > > > 'lustre_cfg_new()' can return ERR_PTR(-ENOMEM). > > Handle these errors and propagate the error code to the callers. > > > > Error handling has been rearranged in 'lustre_process_log()' with the > > addition of a label in order to free some resources. > > I wonder if we should just make it return NULL on allocation failure, > and then at least the other error handling that is there (i.e. in your other patch) > would become correct. > This would make handling in mgc_apply_recover_logs incorrect, but it's already > geared towards this sort of handling anyway, as it discards the passed error > and sets ENOMEM unconditionally (just need to revert 3092c34a in a way). The header lustre_cfg.h is meant to be a UAPI header file. It is used for our userland tools but with the current shape of lustre_cfg.h upstream our tools will not build with it. So having kzalloc and kfree in this header is incorrect. To do this right I need to update our user land tools as well so we should hold off on these patches.