xfs
[Top] [All Lists]

Re: [PATCH 1/1] xfs: fix the symbolic link assert in xfs_ifree

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 1/1] xfs: fix the symbolic link assert in xfs_ifree
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Fri, 07 Jun 2013 09:05:51 -0500
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130607010615.GH29338@dastard>
References: <20130606161032.753011157@xxxxxxx> <20130606161027.166439519@xxxxxxx> <20130607010615.GH29338@dastard>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 06/06/13 20:06, Dave Chinner wrote:
On Thu, Jun 06, 2013 at 11:10:33AM -0500, Mark Tinguely wrote:
Adding an extended attribute to a symbolic link can force that
link to an remote extent. xfs_inactive() incorrectly assumes
that any symbolic link small enough to be in the inode core
is incore, the remote extent is not cleaned and xfs_ifree()
asserts on presence the remote extent.

Signed-off-by: Mark Tinguely<tinguely@xxxxxxx>
---
  fs/xfs/xfs_vnodeops.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/fs/xfs/xfs_vnodeops.c
===================================================================
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -325,7 +325,7 @@ xfs_inactive(
                /*
                 * Zero length symlinks _can_ exist.
                 */
-               if (ip->i_d.di_size>  XFS_IFORK_DSIZE(ip)) {
+               if (ip->i_d.di_nextents) {
                        error = xfs_inactive_symlink_rmt(ip,&tp);
                        if (error)
                                goto out_cancel;

This should match the check done in xfs_readlink. i.e. it should
check against the fork format being in local or extent form, not
check against the inode size.

Also, I think that this symlink specific code should be factored out
of xfs_inactive() and moved to fs/xfs/xfs_symlink.c as
xfs_symlink_truncate() so that all the intricacies of the symlink
truncation are in the one place. This would make
xfs_symlink_truncate() look very similar to xfs_readlink()...



Sounds good.

--Mark.

<Prev in Thread] Current Thread [Next in Thread>