[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210104021842.GB28414@casper.infradead.org>
Date: Mon, 4 Jan 2021 02:18:42 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
Cc: linux-fsdevel@...r.kernel.org, viro@...iv.linux.org.uk,
linux-kernel@...r.kernel.org, pali@...nel.org, dsterba@...e.cz,
aaptel@...e.com, rdunlap@...radead.org, joe@...ches.com,
mark@...mstone.com, nborisov@...e.com,
linux-ntfs-dev@...ts.sourceforge.net, anton@...era.com,
dan.carpenter@...cle.com, hch@....de, ebiggers@...nel.org,
andy.lavr@...il.com
Subject: Re: [PATCH v17 04/10] fs/ntfs3: Add file operations and
implementation
On Thu, Dec 31, 2020 at 06:23:55PM +0300, Konstantin Komarov wrote:
> +/*
> + * file_operations::iterate_shared
> + *
> + * Use non sorted enumeration.
> + * We have an example of broken volume where sorted enumeration
> + * counts each name twice
> + */
> +static int ntfs_readdir(struct file *file, struct dir_context *ctx)
> +{
> + const struct INDEX_ROOT *root;
> + u64 vbo;
> + size_t bit;
> + loff_t eod;
> + int err = 0;
> + struct inode *dir = file_inode(file);
> + struct ntfs_inode *ni = ntfs_i(dir);
> + struct super_block *sb = dir->i_sb;
> + struct ntfs_sb_info *sbi = sb->s_fs_info;
> + loff_t i_size = i_size_read(dir);
> + u32 pos = ctx->pos;
> + u8 *name = NULL;
> + struct indx_node *node = NULL;
> + u8 index_bits = ni->dir.index_bits;
> +
> + /* name is a buffer of PATH_MAX length */
> + static_assert(NTFS_NAME_LEN * 4 < PATH_MAX);
> +
> + eod = i_size + sbi->record_size;
> +
> + if (pos >= eod)
> + return 0;
> +
> + if (!dir_emit_dots(file, ctx))
> + return 0;
> +
> + /* allocate PATH_MAX bytes */
> + name = __getname();
> + if (!name)
> + return -ENOMEM;
> +
> + ni_lock(ni);
What is this lock protecting?
Powered by blists - more mailing lists