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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68B6CC54EE9 for ; Mon, 19 Sep 2022 11:54:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E28366B0074; Mon, 19 Sep 2022 07:54:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD6D280007; Mon, 19 Sep 2022 07:54:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC656940007; Mon, 19 Sep 2022 07:54:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BD2396B0074 for ; Mon, 19 Sep 2022 07:54:09 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7F347161C7C for ; Mon, 19 Sep 2022 11:54:09 +0000 (UTC) X-FDA: 79928676618.21.953C0B3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 1B941160008 for ; Mon, 19 Sep 2022 11:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663588448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hxH7XjLCdlYQTKyCIzL976yQ4mhPMOVNZUR3p/LmDx8=; b=HIfpBzIpTmDdJ8fR5z32qQJCqZA/u+k3Td+Z6jt2BEHvnRngcOHqNZvcP6jJ/CVbM3+saA aoCKqrE25iZQ81hAyVSh3r48RAdmo3c8cA+T/CwpHGEoeaFUvnTqSF4nAyqPzqxEXNYwm1 n8pnMACJnQ6jSIyHIjLSq/uyFds4f/Y= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-649-0jKqubr0Po2ZcqmlDZLzKg-1; Mon, 19 Sep 2022 07:54:07 -0400 X-MC-Unique: 0jKqubr0Po2ZcqmlDZLzKg-1 Received: by mail-wm1-f69.google.com with SMTP id r65-20020a1c4444000000b003b3309435a9so4549723wma.6 for ; Mon, 19 Sep 2022 04:54:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=hxH7XjLCdlYQTKyCIzL976yQ4mhPMOVNZUR3p/LmDx8=; b=ZkoQU1oH/25v5PNmr2gJp4y05X4WSZIjMlr8Xylc9RqrUXlmRgNrjQJrQ+bPdentiV GyoF82VerCMNpRXopeMNfPiMtHC1G2l4e/8O6398fj5BS/H01O53HFjV064rwxOVBzNm e923qKGyiPQU1xmGPthknH3bxijQS8Z9U5c+4/bjRW3DtJhvU35cy9K/zQuK4jookM6Z deOsnsCAUlemKK/QgHYN9A5GDHaoWBKvvk75LpWk4dzODS5Cqk+TSvvDZjsbKMNw3Unh L9dwc/BhImHIvjTfp9gjGn98gD5wp1M9ulbgTzOXLqlei3jipT9LMvWeo/48vqzTmKao mD0A== X-Gm-Message-State: ACrzQf2dVjRZMe77h/N0hvA0x8GIfVE8pbn5guXol0L+O9E2QJct1GyE x4zYEbczd1CXdpCdUGh4ecyW9hPebqUsNLhM2xbMzGKxCbQRV8hnY7tW7Ga4nHWgSKlW+LJ2ZE9 h56pSvDRQPd0= X-Received: by 2002:a05:6000:10ca:b0:22a:3318:861f with SMTP id b10-20020a05600010ca00b0022a3318861fmr9934755wrx.284.1663588446325; Mon, 19 Sep 2022 04:54:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HbiOSrTrk9TAE5NnDOP0QYF+RHfacKHcGcpTYDBiBVoe5noLLX571BUd1lbeary1JNbNsLg== X-Received: by 2002:a05:6000:10ca:b0:22a:3318:861f with SMTP id b10-20020a05600010ca00b0022a3318861fmr9934743wrx.284.1663588446069; Mon, 19 Sep 2022 04:54:06 -0700 (PDT) Received: from ?IPV6:2003:cb:c703:c100:c136:f914:345f:f5f3? (p200300cbc703c100c136f914345ff5f3.dip0.t-ipconnect.de. [2003:cb:c703:c100:c136:f914:345f:f5f3]) by smtp.gmail.com with ESMTPSA id z20-20020a05600c0a1400b003b4727d199asm13853417wmp.15.2022.09.19.04.54.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Sep 2022 04:54:05 -0700 (PDT) Message-ID: <9b0cd14c-2a7d-b3f6-7588-90bc5859d102@redhat.com> Date: Mon, 19 Sep 2022 13:54:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 To: Akinobu Mita Cc: linux-doc@vger.kernel.org, LKML , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Jonathan Corbet , osalvador@suse.de, shuah@kernel.org, Zhao Gongyi , Wei Yongjun , Yicong Yang References: <20220917071427.28499-1-akinobu.mita@gmail.com> <93c044ca-7d2f-e23f-8eb4-72c133737a15@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH -v2] lib/notifier-error-inject: fix error when writing errno to debugfs file In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663588449; a=rsa-sha256; cv=none; b=tHi/7i5b/t7tLjdmxux0hBH3XNREqJMF9v3fdYRMfA9jLXCcuKijGztBKhr2Kf96efYm2a QenuhWNZPeSS+Y5+SvYigEfit3lLUli2nKwDsU3dCLGh7NlVXXmulhXai5GzcFRoNw2JIE lZHcZjgDdBmjUUx71w/AvvHdG/Aei8g= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HIfpBzIp; spf=pass (imf08.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663588449; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hxH7XjLCdlYQTKyCIzL976yQ4mhPMOVNZUR3p/LmDx8=; b=WA7TFrI6IUsXSzKQb7Chr+mlC9E8ObWJle28TnyAOtjDZwCGjrggur03e0lWsKW3Vk+uAl s+jnf0ebq0P6SmKpTAK9A3daKsHabL/GiQNfOW8GcO5VAeW1LZteREPgPkQzUKu0lcKxZm aRK1G68BTvYg/sYVEqm9nWmpmqK6jfk= X-Stat-Signature: aj44c61xhm4hky8qu4qgqzyhw1yj6m8k X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HIfpBzIp; spf=pass (imf08.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1B941160008 X-HE-Tag: 1663588448-446741 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 19.09.22 13:40, Akinobu Mita wrote: > 2022年9月19日(月) 18:20 David Hildenbrand : >> >> On 17.09.22 09:14, Akinobu Mita wrote: >>> The simple attribute files do not accept a negative value since the >>> commit 488dac0c9237 ("libfs: fix error cast of negative value in >>> simple_attr_write()"), so we can no longer use DEFINE_SIMPLE_ATTRIBUTE() to >>> define a file operations for errno value. >>> >>> Fixes: 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()") >>> Reported-by: Zhao Gongyi >>> Signed-off-by: Akinobu Mita >> >> But shouldn't we fix simple_attr_write() instead? >> >> I mean, simple_attr_read() might use attr->fmt to print a signed value, >> but simple_attr_write() fails on signed values now? >> >> I might be wrong, but there is a disconnect. I feel like >> simple_attr_write() should similarly make decisions based on attr->fmt. > > I agree there is a disconnect, but I have no idea how to fix > simple_attr_write(). > (strcmp(attr->fmt, "%%lld\n") is ugly) > If no one seems to come up with a good idea, I'll fix the similar problems > in fault-injection the same way I did here. > Maybe we simply want another interface for the handful of %lld users. Or another way to allow DEFINE_SIMPLE_ATTRIBUTE users to specify it. Might be good enough to specify instead of/in addition to "%llu" an enum that expresses what we want. $ git grep -C2 DEFINE_SIMPLE | grep "\%" tells me that we have a) %llu b) %llx c) %lld d) 0x%llx e) 0x%08llx Maybe we can adjust the debugfs cases to be more similar, to eventually get only a, b and c. -- Thanks, David / dhildenb