From: Mark Tinguely <tinguely@sgi.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v3] xfs: fix the symbolic link assert in xfs_ifree
Date: Fri, 14 Jun 2013 08:30:18 -0500 [thread overview]
Message-ID: <51BB1AEA.8060100@sgi.com> (raw)
In-Reply-To: <20130614021720.GR29338@dastard>
On 06/13/13 21:17, Dave Chinner wrote:
> On Thu, Jun 13, 2013 at 12:04:49PM -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, resulting in the remote extent to not be removed.
>> xfs_ifree() will assert on presence of this leaked remote extent.
>>
>> Signed-off-by: Mark Tinguely<tinguely@sgi.com>
> .....
>> +/*
>> + * xfs_inactive_symlink - free a symlink
>> + */
>> +int
>> +xfs_inactive_symlink(
>> + struct xfs_inode *ip,
>> + struct xfs_trans **tp)
>> +{
>> + struct xfs_mount *mp = ip->i_mount;
>> + xfs_fsize_t pathlen;
>
> int will do here - it can't be more than MAXPATHLEN = 1024, and this
> gets rid of the casts in the error print.
>
>> +
>> + trace_xfs_readlink(ip);
>
> trace_xfs_inactive_symlink, as you mentioned ;)
sigh, and I reverted the inactive and symlink in the trace below. sigh
again.
>
>> +
>> + ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
>> +
>> + if (XFS_FORCED_SHUTDOWN(mp))
>> + return XFS_ERROR(EIO);
>> +
>> + /*
>> + * Zero length symlinks _can_ exist.
>> + */
>> + pathlen = ip->i_d.di_size;
>> + if (!pathlen)
>> + return 0;
>> +
>> + if (pathlen< 0 || pathlen> MAXPATHLEN) {
>> + xfs_alert(mp, "%s: inode (%llu) bad symlink length (%lld)",
>> + __func__, (unsigned long long) ip->i_ino,
> ^ whitespace
>> + (long long) pathlen);
>
> Can we change this to a hex-based inode number (much easier to read)
> and the pathlen cast can go away if you use an int. i.e.:
>
> xfs_alert(mp, "%s: inode (0x%llx) bad symlink length (%d)",
> __func__, (unsigned long long)ip->i_ino, pathlen);
>
>
Both of the items above were stole directly from xfs_readlink().
Thought they should be consistent(ly wrong :) ).
>> + ASSERT(0);
>> + return XFS_ERROR(EFSCORRUPTED);
>> + }
>> +
>> + if (ip->i_df.if_flags& XFS_IFINLINE) {
>> + if (ip->i_df.if_bytes> 0)
>> + xfs_idata_realloc(ip, -(ip->i_df.if_bytes),
>> + XFS_DATA_FORK);
>> + ASSERT(ip->i_df.if_bytes == 0);
>> + return 0;
>> + }
>> +
>> + /* remove the remote symlink */
>> + return(xfs_inactive_symlink_rmt(ip, tp));
>
> And no () around xfs_inactive_symlink_rmt().
>
>> +}
>> Index: b/fs/xfs/xfs_symlink.h
>> ===================================================================
>> --- a/fs/xfs/xfs_symlink.h
>> +++ b/fs/xfs/xfs_symlink.h
>> @@ -60,7 +60,7 @@ extern const struct xfs_buf_ops xfs_syml
>> int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
>> const char *target_path, umode_t mode, struct xfs_inode **ipp);
>> int xfs_readlink(struct xfs_inode *ip, char *link);
>> -int xfs_inactive_symlink_rmt(struct xfs_inode *ip, struct xfs_trans **tpp);
>> +int xfs_inactive_symlink(struct xfs_inode *ip, struct xfs_trans **tpp);
>>
>> #endif /* __KERNEL__ */
>> #endif /* __XFS_SYMLINK_H */
>> Index: b/fs/xfs/xfs_trace.h
>> ===================================================================
>> --- a/fs/xfs/xfs_trace.h
>> +++ b/fs/xfs/xfs_trace.h
>> @@ -594,6 +594,8 @@ DEFINE_INODE_EVENT(xfs_inode_set_eofbloc
>> DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
>> DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
>>
>> +DEFINE_INODE_EVENT(xfs_symlink_inactive);
>> +
>
> No need for the extra whitespace, just put it hard up against the
> other DEFINE_INODE_EVENT()s. Might be better to put it directly
> after the readlink trace definition.
>
> Cheers,
>
> Dave.
Thanks.
--Mark.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2013-06-14 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-13 17:04 [PATCH v3] xfs: fix the symbolic link assert in xfs_ifree Mark Tinguely
2013-06-13 17:50 ` Mark Tinguely
2013-06-13 17:53 ` Mark Tinguely
2013-06-14 2:17 ` Dave Chinner
2013-06-14 13:30 ` Mark Tinguely [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51BB1AEA.8060100@sgi.com \
--to=tinguely@sgi.com \
--cc=david@fromorbit.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.