From: Su Yue <damenly.su@gmail.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>,
Su Yue <suy.fnst@cn.fujitsu.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs-progs: check: check symlinks with append/immutable flags
Date: Mon, 14 May 2018 19:52:20 +0800 [thread overview]
Message-ID: <a89b4c6d-49c0-8f0c-73ab-10c70e03708e@gmail.com> (raw)
In-Reply-To: <6250dfd4-80c3-1714-27f4-d0091ef411a6@gmx.com>
[-- Attachment #1: Type: text/plain, Size: 2491 bytes --]
On 2018/5/14 7:22 PM, Qu Wenruo wrote:
>
>
> On 2018年05月14日 18:29, Su Yue wrote:
>> Define new macro I_ERR_ODD_INODE_FLAGS to represents odd inode flags.
>>
>> Symlinks should never have append/immutable flags.
>> While processing inodes, if found a symlink with append/immutable
>> flags, mark the inode record with I_ERR_ODD_INODE_FLAGS.
>>
>> This is for original mode.
>>
>> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
>> ---
>> check/main.c | 7 +++++++
>> check/mode-original.h | 1 +
>> 2 files changed, 8 insertions(+)
>>
>> diff --git a/check/main.c b/check/main.c
>> index 68da994f7ae0..f5f52c406046 100644
>> --- a/check/main.c
>> +++ b/check/main.c
>> @@ -576,6 +576,8 @@ static void print_inode_error(struct btrfs_root *root, struct inode_record *rec)
>> fprintf(stderr, ", link count wrong");
>> if (errors & I_ERR_FILE_EXTENT_ORPHAN)
>> fprintf(stderr, ", orphan file extent");
>> + if (errors & I_ERR_ODD_INODE_FLAGS)
>> + fprintf(stderr, ", odd inode flags");
>> fprintf(stderr, "\n");
>> /* Print the orphan extents if needed */
>> if (errors & I_ERR_FILE_EXTENT_ORPHAN)
>> @@ -805,6 +807,7 @@ static int process_inode_item(struct extent_buffer *eb,
>> {
>> struct inode_record *rec;
>> struct btrfs_inode_item *item;
>> + u64 flags;
>>
>> rec = active_node->current;
>> BUG_ON(rec->ino != key->objectid || rec->refs > 1);
>> @@ -822,6 +825,10 @@ static int process_inode_item(struct extent_buffer *eb,
>> rec->found_inode_item = 1;
>> if (rec->nlink == 0)
>> rec->errors |= I_ERR_NO_ORPHAN_ITEM;
>> + flags = btrfs_inode_flags(eb, item);
>> + if (rec->imode & BTRFS_FT_SYMLINK &&
>> + flags & (BTRFS_INODE_IMMUTABLE | BTRFS_INODE_APPEND))
>> + rec->errors = I_ERR_ODD_INODE_FLAGS;
>
> Shouldn't it be "|=" instead of "=" ?
>
> Thanks,
> Qu
Oh... Should be "|=".
Thanks,
Su
>
>> maybe_free_inode_rec(&active_node->inode_cache, rec);
>> return 0;
>> }
>> diff --git a/check/mode-original.h b/check/mode-original.h
>> index 368de692fdd1..13cfa5b9e1b3 100644
>> --- a/check/mode-original.h
>> +++ b/check/mode-original.h
>> @@ -186,6 +186,7 @@ struct file_extent_hole {
>> #define I_ERR_LINK_COUNT_WRONG (1 << 13)
>> #define I_ERR_FILE_EXTENT_ORPHAN (1 << 14)
>> #define I_ERR_FILE_EXTENT_TOO_LARGE (1 << 15)
>> +#define I_ERR_ODD_INODE_FLAGS (1 << 16)
>>
>> struct inode_record {
>> struct list_head backrefs;
>>
>
[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 1787 bytes --]
next prev parent reply other threads:[~2018-05-14 11:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 10:29 [PATCH 0/3] btrfs-progs: check: verify symlinks with append/immutable flags Su Yue
2018-05-14 10:29 ` [PATCH 1/3] btrfs-progs: check: check " Su Yue
2018-05-14 11:18 ` Nikolay Borisov
2018-05-14 12:12 ` Su Yue
2018-05-14 11:22 ` Qu Wenruo
2018-05-14 11:52 ` Su Yue [this message]
2018-05-14 10:29 ` [PATCH 2/3] btrfs-progs: lowmem: " Su Yue
2018-05-14 11:17 ` Nikolay Borisov
2018-05-14 12:04 ` Su Yue
2018-05-14 11:27 ` Qu Wenruo
2018-05-14 10:29 ` [PATCH 3/3] btrfs-progs: fsck-tests: add test case to check symlinks with odd flags Su Yue
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=a89b4c6d-49c0-8f0c-73ab-10c70e03708e@gmail.com \
--to=damenly.su@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
--cc=suy.fnst@cn.fujitsu.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 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).