From patchwork Wed Oct 5 17:04:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 9485671 X-Mozilla-Keys: nonjunk Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sandeen.net X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0 X-Spam-HP: BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5,RP_MATCHES_RCVD=-0.1 X-Original-To: sandeen@sandeen.net Delivered-To: sandeen@sandeen.net Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by sandeen.net (Postfix) with ESMTP id C2A761738C8 for ; Wed, 5 Oct 2016 12:03:30 -0500 (CDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752831AbcJEREI (ORCPT ); Wed, 5 Oct 2016 13:04:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:60326 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752346AbcJEREI (ORCPT ); Wed, 5 Oct 2016 13:04:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E496AADD9 for ; Wed, 5 Oct 2016 17:04:05 +0000 (UTC) To: linux-xfs@vger.kernel.org From: Jeff Mahoney Subject: [PATCH] xfs: clear di_forkoff on ialloc Message-ID: Date: Wed, 5 Oct 2016 13:04:04 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Commit 6dfe5a049f2 (xfs: xfs_attr_inactive leaves inconsistent attr fork state behind) fixed an issue where an inconsistent attr fork count persisted on disk if there was concurrent inode writeback happening after the inode was evicted from the VFS layer. If one of those inodes landed on disk and was reused, it may have an invalid di_forkoff, which can cause problems when trying to add new extended attributes. Since we clear the rest of the attribute fork values on ialloc, let's clear di_forkoff as well and ensure the invalid value won't be encountered. Signed-off-by: Jeff Mahoney Reviewed-by: Eric Sandeen --- fs/xfs/xfs_inode.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -835,6 +835,7 @@ xfs_ialloc( */ ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; ip->i_d.di_anextents = 0; + ip->i_d.di_forkoff = 0; /* * Log the new values stuffed into the inode.