Re: [PATCH v3 2/2] io_uring: add support for IORING_OP_GETDENTS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 19, 2021 at 12:34:03PM +0000, Matthew Wilcox wrote:

> > IORING_OP_GETDENTS may or may not update the specified directory's
> > file offset, and the file offset should not be relied upon having
> > any particular value during or after an IORING_OP_GETDENTS call.
> 
> This doesn't give me the warm fuzzies.  What I might suggest
> is either passing a parameter to iterate_dir() or breaking out an
> iterate_dir_nofpos() to make IORING_OP_GETDENTS more of a READV operation.
> ie the equivalent of this:
> 
> @@ -37,7 +37,7 @@
>  } while (0)
>  
>  
> -int iterate_dir(struct file *file, struct dir_context *ctx)
> +int iterate_dir(struct file *file, struct dir_context *ctx, bool use_fpos)
>  {
>         struct inode *inode = file_inode(file);
>         bool shared = false;
> @@ -60,12 +60,14 @@ int iterate_dir(struct file *file, struct dir_context *ctx)
>  
>         res = -ENOENT;
>         if (!IS_DEADDIR(inode)) {
> -               ctx->pos = file->f_pos;
> +               if (use_fpos)
> +                       ctx->pos = file->f_pos;
>                 if (shared)
>                         res = file->f_op->iterate_shared(file, ctx);
>                 else
>                         res = file->f_op->iterate(file, ctx);
> -               file->f_pos = ctx->pos;
> +               if (use_fpos)
> +                       file->f_pos = ctx->pos;
>                 fsnotify_access(file);
>                 file_accessed(file);
>         }
> 
> That way there's no need to play with llseek or take a mutex on the
> f_pos of the directory.

I'll try this!



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux