Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2528610ybc; Mon, 18 Nov 2019 00:00:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyWCqhXQaGMeBKyodez3VnleQJDe5lAyAE0EFw7SNH4nuFpqMBWw9S5MvBCpfDlaw96aL8C X-Received: by 2002:a17:906:b6c3:: with SMTP id ec3mr25621437ejb.27.1574064052313; Mon, 18 Nov 2019 00:00:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574064052; cv=none; d=google.com; s=arc-20160816; b=ng9gUUGgh+mc3kf/+KpkLRKTiSuMryeTLy8teQX2nntSP2xxaoTtiEU3LD/hxB5M3q 3g7x/NKicCx00ahlXOHkAmItfRgL/JyR7dMhg5R8xAo2/XNNnvi3tMdS5u4PU5NKCn1a JOu+qf087Do0Nbkab2x/qIyW+I4DKi/XEt4UeMKHNJoMmx6yzbpWStPO3hMdPtO8SVRz b54T1bpIkwF39k9KJ+Xv/5dZYXSsGy57MIG5qy83NwJ97sArtLe+ULEU39hJeJFUBKFi 6mVzuvWmWow0Rm1PR4v8XLq0dvnneJa+EduoF+wfhR1zOt1Crgzqq5lKrKAqTsBqo+4w twHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=PC1rjxY+RnawqXi1AWYzbYrgzCjN0J8yUFXvNmmOo6c=; b=xTP3ugMzlzDGXZ2tuVFht0Ubjd1zl7n+orefSDmN5aoO6zyVKwVlkn748tTZAXKj20 VrsIPdktBefSTOXX/kXRJbE3xPTTzU5Jg8DFYDeq9Hcvw5bwo0ti5j7jlZICFV3tCJ7K HCqPiGSwh71vNY431pB6flYcCOMnGs8uS7IjV0ySH2b9uwc3xPQwiY/X/f7sZhDBkoLM yhnrz+aIMemp3KXfCgw4ppcY48gI9160MjS/BEcA6kukOMRNlZ/MrGX5HAFPu/HKKlWF ESOHeMj++QV/Bk5eBxjanj7gpHLjpkVdIQvsxu19nMXUFJhTxSei38WnYY0A/4JOiE1Z +G4g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v23si10768565edy.287.2019.11.18.00.00.21; Mon, 18 Nov 2019 00:00:52 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726283AbfKRH7h (ORCPT + 99 others); Mon, 18 Nov 2019 02:59:37 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:25528 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726666AbfKRH7g (ORCPT ); Mon, 18 Nov 2019 02:59:36 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAI7vFTa013516 for ; Mon, 18 Nov 2019 02:59:35 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2waygjshys-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 02:59:35 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Nov 2019 07:59:32 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 18 Nov 2019 07:59:29 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAI7xSoE39125068 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2019 07:59:29 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DAC03A4067; Mon, 18 Nov 2019 07:59:28 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D2C5BA4066; Mon, 18 Nov 2019 07:59:27 +0000 (GMT) Received: from [9.199.158.191] (unknown [9.199.158.191]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 18 Nov 2019 07:59:27 +0000 (GMT) Subject: Re: [PATCH] jbd2: Make jbd2_handle_buffer_credits() handle reserved handles To: Jan Kara , Ted Tso Cc: linux-ext4@vger.kernel.org, Eric Biggers References: <20191115102210.29445-1-jack@suse.cz> From: Ritesh Harjani Date: Mon, 18 Nov 2019 13:29:21 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20191115102210.29445-1-jack@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19111807-0028-0000-0000-000003B9C9FA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111807-0029-0000-0000-0000247CE12B Message-Id: <20191118075927.D2C5BA4066@b06wcsmtp001.portsmouth.uk.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_01:2019-11-15,2019-11-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=804 priorityscore=1501 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911180070 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 11/15/19 3:52 PM, Jan Kara wrote: > The helper jbd2_handle_buffer_credits() doesn't correctly handle reserved > handles which can lead to crashes. Fix it getting of journal pointer to > work for reserved handles as well. > > Fixes: a9a8344ee171 ("ext4, jbd2: Provide accessor function for handle credits") > Reported-by: Eric Biggers > Signed-off-by: Jan Kara Thanks Jan, Yes, this also fixes the problem for me with dioread_nolock on ppc64 machine. You may add - Tested-by: Ritesh Harjani > --- > include/linux/jbd2.h | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h > index 3115eeb44039..a23a3528e07a 100644 > --- a/include/linux/jbd2.h > +++ b/include/linux/jbd2.h > @@ -1648,10 +1648,14 @@ static inline tid_t jbd2_get_latest_transaction(journal_t *journal) > return tid; > } > > - > static inline int jbd2_handle_buffer_credits(handle_t *handle) > { > - journal_t *journal = handle->h_transaction->t_journal; > + journal_t *journal; > + > + if (!handle->h_reserved) > + journal = handle->h_transaction->t_journal; > + else > + journal = handle->h_journal; > > return handle->h_total_credits - > DIV_ROUND_UP(handle->h_revoke_credits_requested, >