Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1017050pxb; Wed, 3 Nov 2021 16:45:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPqDaJMbnqLN8pmrIPjdNLA2n7rfWd7crgkLihz+9G9/KGXTu8gabTsXtyBZ9esPiZZITg X-Received: by 2002:a05:6638:190f:: with SMTP id p15mr1211587jal.82.1635983100216; Wed, 03 Nov 2021 16:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635983100; cv=none; d=google.com; s=arc-20160816; b=1DueDyJPkFDDBOS3KkbURUJVY1Thx+ap0oDFvTIMaiy4/UesLOs75hKjyuo13g8cAG hI3IlU/ZrIMgmLpm93WEf9BmH5bfDnEk0AZQkaDdNkvmXx/BETJt6sZYtVg8yR5k5O3t uKgpUimOvcRmsaHT/7hAugdqRTtNCDqMl9Kf8yEtV4alP+HCGOn/CuxDnZ1lHrK8MzHk 4C2J4ZbrYfEHX+3QFInfx5ozlMDhQS6LNiApwWXtFH2YlYIQyoURqQlKXy59tPe1cSR5 x2FgptrdVn+02uHwvE7jOurZAaigUavH5uPDfh61w8SjzW4JXdj8VRhuWN81JlnwPHC6 yuNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:organization :dkim-signature; bh=TY3Hzrdo8eAbxokPf+Hgzthrnx4D+WJ0/5UlAdCUFUc=; b=v3A2AXTXEdECa8nUN3PsZg2/sCJgUvI+EdmyS4S2guEbqRXCxT3v63CmnJCHq6XWi6 Tvk04TgCJhRTz/OdKKlWWnp74hhRJ050GgTe7SUB2ivDGvNIZ8A+7qv+/C3JfZiCI7w9 A6RgmGmj8gGv5KvnUZgMQtB29UnXsWhq6PQZ0XwkZOWNfmhzvJ7FTq41zSKjixEVDL5H hnxytbYqDZpXyAG/nHkclB9XaXMBSvLeMTb2DaRckx9GXnxF9KbGlD4KpDS/Y/vTstuV toOpWSLbmprAMya1OrPgzojO9vJysQGBio+GjRW9TnPoJJS+c+jWG+o4KRnaMtt4tguC e7yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S2zIvAMI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si8365700iov.79.2021.11.03.16.44.47; Wed, 03 Nov 2021 16:45:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S2zIvAMI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbhKCXq0 (ORCPT + 99 others); Wed, 3 Nov 2021 19:46:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33981 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbhKCXqZ (ORCPT ); Wed, 3 Nov 2021 19:46:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635983028; 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; bh=TY3Hzrdo8eAbxokPf+Hgzthrnx4D+WJ0/5UlAdCUFUc=; b=S2zIvAMIO1TSgHFwZwio53ENWCSi8TOB/NMHlV2Rday3YG2Uzkd+N5ORG4yu5WGMVq8mwh 4K/jzfLMBRI0vvrnGKuoAAnseEhcHmB4yO2NV04ss/jcejft5SzZAINT/P88xxampyqduP s0spwbwqT8Viq56ZETP+Xbs92Hv+Rm4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-331-_5gveUDqMF2UbP-vjO6A3Q-1; Wed, 03 Nov 2021 19:43:45 -0400 X-MC-Unique: _5gveUDqMF2UbP-vjO6A3Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3BF9B8066F4; Wed, 3 Nov 2021 23:43:44 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55F9E19C79; Wed, 3 Nov 2021 23:43:21 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH] afs: Fix ENOSPC, EDQUOT and other errors to fail a write rather than retrying From: David Howells To: marc.dionne@auristor.com Cc: Jeffrey E Altman , linux-afs@lists.infradead.org, dhowells@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 03 Nov 2021 23:43:20 +0000 Message-ID: <163598300034.1327800.8060660349996331911.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, at the completion of a storage RPC from writepages, the errors ENOSPC, EDQUOT, ENOKEY, EACCES, EPERM, EKEYREJECTED and EKEYREVOKED cause the pages involved to be redirtied and the write to be retried by the VM at a future time. However, this is probably not the right thing to do, and, instead, the writes should be discarded so that the system doesn't get blocked (though unmounting will discard the uncommitted writes anyway). Fix this by making afs_write_back_from_locked_page() call afs_kill_pages() instead of afs_redirty_pages() in those cases. EKEYEXPIRED is left to redirty the pages on the assumption that the caller just needs to renew their key. Unknown errors also do that, though it might be better to squelch those too. This can be triggered by the generic/285 xfstest. The writes can be observed in the server logs. If a write fails with ENOSPC (ie. CODE 49733403, UAENOSPC) because a file is made really large, e.g.: Wed Nov 03 23:21:35.794133 2021 [1589] EVENT YFS_SRX_StData CODE 49733403 NAME --UnAuth-- HOST [192.168.1.2]:7001 ID 32766 FID 1048664:0.172306:30364251 UINT64 17592187027456 UINT64 65536 UINT64 17592187092992 UINT64 0 this should be seen once and not repeated. Reported-by: Marc Dionne Signed-off-by: David Howells cc: Jeffrey E Altman cc: linux-afs@lists.infradead.org --- fs/afs/write.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/afs/write.c b/fs/afs/write.c index 8b1d9c2f6bec..04f3f87b15cb 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -620,22 +620,18 @@ static ssize_t afs_write_back_from_locked_page(struct address_space *mapping, default: pr_notice("kAFS: Unexpected error from FS.StoreData %d\n", ret); fallthrough; - case -EACCES: - case -EPERM: - case -ENOKEY: case -EKEYEXPIRED: - case -EKEYREJECTED: - case -EKEYREVOKED: afs_redirty_pages(wbc, mapping, start, len); mapping_set_error(mapping, ret); break; + case -EACCES: + case -EPERM: + case -ENOKEY: + case -EKEYREJECTED: + case -EKEYREVOKED: case -EDQUOT: case -ENOSPC: - afs_redirty_pages(wbc, mapping, start, len); - mapping_set_error(mapping, -ENOSPC); - break; - case -EROFS: case -EIO: case -EREMOTEIO: