linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Andreas Dilger <adilger@dilger.ca>
Cc: "tytso@mit.edu" <tytso@mit.edu>,
	"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 02/24] debugfs: Only print the first 60 bytes from i_block on a fast symlink
Date: Tue, 22 Jul 2014 13:34:38 -0700	[thread overview]
Message-ID: <20140722203438.GC8628@birch.djwong.org> (raw)
In-Reply-To: <B72871BE-3D5E-4A07-8EDE-9B4032119174@dilger.ca>

On Sat, Jul 19, 2014 at 10:49:35AM -0600, Andreas Dilger wrote:
> Wouldn't it be better to decode and print the whole symlink from the inline
> data?  Depending on the use of debugfs, printing only the first 60 bytes may
> cause people/scripts to think the link is corrupted. 

Hmm, you're right, this /does/ expose some weird behavior w.r.t. fast link
printing.  I think I should go further and inhibit printing of system.data
entirely during xattr dump since dump_inode doesn't print file contents, and
the inline data could be fairly long.

Ok, I retract this patch and I'll repost it as part of the inline data cleanup
later this week.

--D
> 
> Cheers, Andreas
> 
> > On Jul 18, 2014, at 16:52, "Darrick J. Wong" <darrick.wong@oracle.com> wrote:
> > 
> > If we have an inline_data fast symlink, i_size can be larger than the
> > size of i_block.  In this case, debugfs prints off the end of the
> > buffer, so fix that.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > debugfs/debugfs.c            |   15 ++++++++++-----
> > tests/d_special_files/expect |    2 +-
> > 2 files changed, 11 insertions(+), 6 deletions(-)
> > 
> > 
> > diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
> > index 51f386b..5eecabe 100644
> > --- a/debugfs/debugfs.c
> > +++ b/debugfs/debugfs.c
> > @@ -783,11 +783,16 @@ void internal_dump_inode(FILE *out, const char *prefix,
> >    }
> > 
> >    if (LINUX_S_ISLNK(inode->i_mode) &&
> > -        ext2fs_inode_data_blocks(current_fs,inode) == 0 &&
> > -        !(inode->i_flags & EXT4_INLINE_DATA_FL))
> > -        fprintf(out, "%sFast_link_dest: %.*s\n", prefix,
> > -            (int) inode->i_size, (char *)inode->i_block);
> > -    else if (LINUX_S_ISBLK(inode->i_mode) || LINUX_S_ISCHR(inode->i_mode)) {
> > +        ext2fs_inode_data_blocks(current_fs, inode) == 0 &&
> > +        !(inode->i_flags & EXT4_INLINE_DATA_FL)) {
> > +        int sz = EXT2_I_SIZE(inode);
> > +
> > +        if (sz > sizeof(inode->i_block))
> > +            sz = sizeof(inode->i_block);
> > +        fprintf(out, "%sFast link dest: \"%.*s\"\n", prefix, sz,
> > +            (char *)inode->i_block);
> > +    } else if (LINUX_S_ISBLK(inode->i_mode) ||
> > +           LINUX_S_ISCHR(inode->i_mode)) {
> >        int major, minor;
> >        const char *devnote;
> > 
> > diff --git a/tests/d_special_files/expect b/tests/d_special_files/expect
> > index 2b2dbfa..f729b0f 100644
> > --- a/tests/d_special_files/expect
> > +++ b/tests/d_special_files/expect
> > @@ -11,7 +11,7 @@ Fragment:  Address: 0    Number: 0    Size: 0
> > ctime: 0x50f560e0 -- Tue Jan 15 14:00:00 2013
> > atime: 0x50f560e0 -- Tue Jan 15 14:00:00 2013
> > mtime: 0x50f560e0 -- Tue Jan 15 14:00:00 2013
> > -Fast_link_dest: bar
> > +Fast link dest: "bar"
> > Exit status is 0
> > debugfs -R ''stat foo2'' -w test.img
> > Inode: 13   Type: symlink    Mode:  0777   Flags: 0x0
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-07-22 20:34 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 22:52 [PATCH 00/24] e2fsprogs patchbomb 7/14, part 1 Darrick J. Wong
2014-07-18 22:52 ` [PATCH 01/24] e4defrag: backwards-allocated files should be defragmented too Darrick J. Wong
2014-07-21 23:44   ` Akira Fujita
2014-07-22 16:32     ` Theodore Ts'o
2014-07-18 22:52 ` [PATCH 02/24] debugfs: Only print the first 60 bytes from i_block on a fast symlink Darrick J. Wong
2014-07-19 16:49   ` Andreas Dilger
2014-07-22 16:43     ` Theodore Ts'o
2014-07-22 20:39       ` Darrick J. Wong
2014-07-22 20:34     ` Darrick J. Wong [this message]
2014-07-18 22:52 ` [PATCH 03/24] debugfs: create idump command to dump an inode in hex Darrick J. Wong
2014-07-22 17:47   ` Theodore Ts'o
2014-07-18 22:52 ` [PATCH 04/24] debugfs: allow bmap to allocate blocks Darrick J. Wong
2014-07-22 17:52   ` Theodore Ts'o
2014-07-18 22:52 ` [PATCH 05/24] e2fsck: report correct inode number in pass1b Darrick J. Wong
2014-07-22 17:47   ` Theodore Ts'o
2014-07-18 22:52 ` [PATCH 06/24] e2fsck: don't offer to recreate the journal if fsck is aborting due to bad block bitmaps Darrick J. Wong
2014-07-22 17:58   ` Theodore Ts'o
2014-07-18 22:53 ` [PATCH 07/24] e2fsck: skip clearing bad extents if bitmaps are unreadable Darrick J. Wong
2014-07-22 17:58   ` Theodore Ts'o
2014-07-18 22:53 ` [PATCH 08/24] e2fsck: fix inode coherency issue when iterating an inode's blocks Darrick J. Wong
2014-07-22 18:58   ` Theodore Ts'o
2014-07-18 22:53 ` [PATCH 09/24] e2fsck: clear i_block if there are too many bad block mappings Darrick J. Wong
2014-07-22 18:59   ` Theodore Ts'o
2014-07-22 22:14     ` Darrick J. Wong
2014-07-22 22:48       ` Theodore Ts'o
2014-07-18 22:53 ` [PATCH 10/24] e2fsck: don't clobber critical metadata during check_blocks Darrick J. Wong
2014-07-25  1:03   ` Theodore Ts'o
2014-07-18 22:53 ` [PATCH 11/24] e2fsck: free ctx->fs, not fs, at the end of fsck Darrick J. Wong
2014-07-25  1:14   ` Theodore Ts'o
2014-07-18 22:53 ` [PATCH 12/24] e2fsck: force all block allocations to use block_found_map Darrick J. Wong
2014-07-25  2:18   ` Theodore Ts'o
2014-07-18 22:53 ` [PATCH 13/24] e2fsck: fix off-by-one bounds check on group number Darrick J. Wong
2014-07-25  2:20   ` Theodore Ts'o
2014-07-18 22:53 ` [PATCH 14/24] libext2fs: fix bounds check of the bitmap test range in get_free_blocks2 Darrick J. Wong
2014-07-25 11:13   ` Theodore Ts'o
2014-07-18 22:54 ` [PATCH 15/24] misc: fix problems with strncat Darrick J. Wong
2014-07-25 11:22   ` Theodore Ts'o
2014-07-18 22:54 ` [PATCH 16/24] e2fsck: don't crash during rehash Darrick J. Wong
2014-07-25 11:22   ` Theodore Ts'o
2014-07-18 22:54 ` [PATCH 17/24] e2fsck: reserve blocks for root/lost+found directory repair Darrick J. Wong
2014-07-25 12:12   ` Theodore Ts'o
2014-07-25 20:19     ` Darrick J. Wong
2014-07-18 22:54 ` [PATCH 18/24] e2fsck: collapse holes in extent-based directories Darrick J. Wong
2014-07-25 12:33   ` Theodore Ts'o
2014-07-18 22:54 ` [PATCH 19/24] e2fsck: always submit logical block 0 of a directory for pass 2 Darrick J. Wong
2014-07-25 12:40   ` Theodore Ts'o
2014-07-18 22:54 ` [PATCH 20/24] e2fsck: pass2 should not process directory blocks that are impossibly large Darrick J. Wong
2014-07-25 12:42   ` Theodore Ts'o
2014-07-18 22:55 ` [PATCH 21/24] e2fsck: clear uninit flag on directory extents Darrick J. Wong
2014-07-25 13:00   ` Theodore Ts'o
2014-07-18 22:55 ` [PATCH 22/24] e2fsck: check return value of ext2fs_extent_fix_parents() Darrick J. Wong
2014-07-25 12:51   ` Theodore Ts'o
2014-07-18 22:55 ` [PATCH 23/24] mke2fs: set error behavior at initialization time Darrick J. Wong
2014-07-25 13:00   ` Theodore Ts'o
2014-07-18 22:55 ` [PATCH 24/24] e2fuzz: Create a tool to fuzz ext* filesystems Darrick J. Wong
2014-07-25 13:16   ` Theodore Ts'o

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=20140722203438.GC8628@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).