From: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
To: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 04/15] cifs: eliminate oflags option from cifs_new_fileinfo
Date: Mon, 11 Oct 2010 11:11:38 +0530 [thread overview]
Message-ID: <4CB2A392.9030400@suse.de> (raw)
In-Reply-To: <1286559072-29032-5-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On 10/08/2010 11:01 PM, Jeff Layton wrote:
> Eliminate the poor, misunderstood "oflags" option from cifs_new_fileinfo.
> The callers mostly pass in the filp->f_flags here, except for one place
> that passes in the flags after they've been converted to their SMB_O_*
> equivalents.
>
> None of these are correct however since we're checking that value for
> the presence of FMODE_READ. Luckily that only affects how the f_list is
> ordered. What it really wants here is the file->f_mode, but this check
> really makes no sense whatsoever. FMODE_READ will be set for O_RDWR or
> O_RDONLY opens. So this in effect just moves those to the front of the
> list and leaves O_WRONLY at the end.
>
> That might make some sense if anything actually paid attention to this
> list order, but nothing does. find_readable_file and find_writable_file
> both walk through the list in the same direction.
>
> Let's just keep this simple and just put things on the list with
> list_add.
>
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> fs/cifs/cifsproto.h | 3 +--
> fs/cifs/dir.c | 15 ++++-----------
> fs/cifs/file.c | 5 ++---
> 3 files changed, 7 insertions(+), 16 deletions(-)
>
> diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
> index 7f416ab..bed004c 100644
> --- a/fs/cifs/cifsproto.h
> +++ b/fs/cifs/cifsproto.h
> @@ -107,8 +107,7 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
>
> extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode,
> __u16 fileHandle, struct file *file,
> - struct tcon_link *tlink,
> - unsigned int oflags, __u32 oplock);
> + struct tcon_link *tlink, __u32 oplock);
> extern int cifs_posix_open(char *full_path, struct inode **pinode,
> struct super_block *sb,
> int mode, int oflags,
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index c205ec9..452c9b5 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -132,7 +132,7 @@ cifs_bp_rename_retry:
>
> struct cifsFileInfo *
> cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, struct file *file,
> - struct tcon_link *tlink, unsigned int oflags, __u32 oplock)
> + struct tcon_link *tlink, __u32 oplock)
> {
> struct dentry *dentry = file->f_path.dentry;
> struct cifsFileInfo *pCifsFile;
> @@ -160,13 +160,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, struct file *file,
> list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList));
> pCifsInode = CIFS_I(newinode);
> if (pCifsInode) {
> - /* if readable file instance put first in list*/
> - if (oflags & FMODE_READ)
> - list_add(&pCifsFile->flist, &pCifsInode->openFileList);
> - else
> - list_add_tail(&pCifsFile->flist,
> - &pCifsInode->openFileList);
> -
> + list_add(&pCifsFile->flist, &pCifsInode->openFileList);
find_readable_file() assumes that if it is a write-only file, it will be
in the tail and it can break out of the loop. That needs to be fixed as
well?
--
Suresh Jayaraman
next prev parent reply other threads:[~2010-10-11 5:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 17:30 [PATCH 00/15] cifs: clean up management of open filehandle (try #3) Jeff Layton
[not found] ` <1286559072-29032-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-08 17:30 ` [PATCH 01/15] cifs: keep dentry reference in cifsFileInfo instead of inode reference Jeff Layton
2010-10-08 17:30 ` [PATCH 02/15] cifs: don't use vfsmount to pin superblock for oplock breaks Jeff Layton
2010-10-08 17:31 ` [PATCH 03/15] cifs: eliminate cifs_posix_open_inode_helper Jeff Layton
2010-10-08 17:31 ` [PATCH 04/15] cifs: eliminate oflags option from cifs_new_fileinfo Jeff Layton
[not found] ` <1286559072-29032-5-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-11 5:41 ` Suresh Jayaraman [this message]
[not found] ` <4CB2A392.9030400-l3A5Bk7waGM@public.gmane.org>
2010-10-11 11:13 ` Jeff Layton
[not found] ` <20101011071322.3a6e090c-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-10-11 17:04 ` Steve French
[not found] ` <AANLkTik4=achQnm=8XN+GWWKFL8QOddz4xVVaBs4X3sX-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-11 17:17 ` Jeff Layton
[not found] ` <20101011131707.646b8532-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-10-11 17:27 ` Steve French
[not found] ` <AANLkTik6tc0iJwDACT-nctOi2Ui5E31AihWN8-vCM2zo-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-11 18:52 ` Jeff Layton
2010-10-08 17:31 ` [PATCH 05/15] cifs: eliminate the inode argument " Jeff Layton
2010-10-08 17:31 ` [PATCH 06/15] cifs: clean up cifs_reopen_file Jeff Layton
2010-10-08 17:31 ` [PATCH 07/15] cifs: cifs_write argument change and cleanup Jeff Layton
2010-10-08 17:31 ` [PATCH 08/15] cifs: eliminate pfile pointer from cifsFileInfo Jeff Layton
2010-10-08 17:31 ` [PATCH 09/15] cifs: move cifs_new_fileinfo to file.c Jeff Layton
2010-10-08 17:31 ` [PATCH 10/15] cifs: convert GlobalSMBSeslock from a rwlock to regular spinlock Jeff Layton
[not found] ` <1286559072-29032-11-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-11 5:45 ` Suresh Jayaraman
[not found] ` <4CB2A478.50401-l3A5Bk7waGM@public.gmane.org>
2010-10-12 13:28 ` Christoph Hellwig
2010-10-08 17:31 ` [PATCH 11/15] cifs: move cifsFileInfo_put to file.c Jeff Layton
2010-10-08 17:31 ` [PATCH 12/15] cifs: move close processing from cifs_close to cifsFileInfo_put Jeff Layton
2010-10-08 17:31 ` [PATCH 13/15] cifs: convert cifsFileInfo->count to non-atomic counter Jeff Layton
[not found] ` <1286559072-29032-14-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-11 5:46 ` Suresh Jayaraman
2010-10-08 17:31 ` [PATCH 14/15] cifs: wait for writeback to complete in cifs_flush Jeff Layton
2010-10-08 17:31 ` [PATCH 15/15] cifs: eliminate cifsInodeInfo->write_behind_rc Jeff Layton
-- strict thread matches above, loose matches on Subject: below --
2010-10-06 19:54 [PATCH 00/15] cifs: clean up management of open filehandle (try #2) Jeff Layton
[not found] ` <1286394857-32541-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-06 19:54 ` [PATCH 04/15] cifs: eliminate oflags option from cifs_new_fileinfo Jeff Layton
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=4CB2A392.9030400@suse.de \
--to=sjayaraman-l3a5bk7wagm@public.gmane.org \
--cc=jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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