lkml.org 
[lkml]   [2021]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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?

\
 
 \ /
  Last update: 2021-01-04 03:23    [W:0.235 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site