From: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Jeff Layton <jlayton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
Subject: Re: [PATCH v2 04/10] locks: move flock locks to file_lock_context
Date: Fri, 9 Jan 2015 06:31:55 -0800 [thread overview]
Message-ID: <20150109143155.GB30294@infradead.org> (raw)
In-Reply-To: <1420742065-28423-5-git-send-email-jlayton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
> void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count)
> {
> struct file_lock *lock;
> + struct file_lock_context *ctx;
>
> *fcntl_count = 0;
> *flock_count = 0;
>
> + spin_lock(&inode->i_lock);
Seems like moving the locking around is unrelated to this patch.
> + list_for_each_entry(fl, &flctx->flc_flock, fl_list) {
> + if (nfs_file_open_context(fl->fl_file)->state != state)
> + continue;
> + spin_unlock(&inode->i_lock);
> + status = ops->recover_lock(state, fl);
> + switch (status) {
> + case 0:
> + break;
> + case -ESTALE:
> + case -NFS4ERR_ADMIN_REVOKED:
> + case -NFS4ERR_STALE_STATEID:
> + case -NFS4ERR_BAD_STATEID:
> + case -NFS4ERR_EXPIRED:
> + case -NFS4ERR_NO_GRACE:
> + case -NFS4ERR_STALE_CLIENTID:
> + case -NFS4ERR_BADSESSION:
> + case -NFS4ERR_BADSLOT:
> + case -NFS4ERR_BAD_HIGH_SLOT:
> + case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
> + goto out;
> + default:
> + printk(KERN_ERR "NFS: %s: unhandled error %d\n",
> + __func__, status);
> + case -ENOMEM:
> + case -NFS4ERR_DENIED:
> + case -NFS4ERR_RECLAIM_BAD:
> + case -NFS4ERR_RECLAIM_CONFLICT:
> + /* kill_proc(fl->fl_pid, SIGLOST, 1); */
> + status = 0;
> + }
Instead of duplicating this huge body of code it seems like a good idea
to add a preparatory patch to factor it out into a helper function.
> +static bool
> +is_whole_file_wrlock(struct file_lock *fl)
> +{
> + return fl->fl_start == 0 && fl->fl_end == OFFSET_MAX && fl->fl_type == F_WRLCK;
> +}
Please break this into multiple lines to stay under 80 characters.
next prev parent reply other threads:[~2015-01-09 14:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-08 18:34 [PATCH v2 00/10] locks: saner method for managing file locks Jeff Layton
2015-01-08 18:34 ` [PATCH v2 01/10] locks: add new struct list_head to struct file_lock Jeff Layton
2015-01-08 18:34 ` [PATCH v2 02/10] locks: have locks_release_file use flock_lock_file to release generic flock locks Jeff Layton
2015-01-09 14:27 ` Christoph Hellwig
2015-01-09 14:42 ` Jeff Layton
2015-01-09 14:46 ` Christoph Hellwig
2015-01-08 18:34 ` [PATCH v2 03/10] locks: add a new struct file_locking_context pointer to struct inode Jeff Layton
2015-01-08 18:34 ` [PATCH v2 04/10] locks: move flock locks to file_lock_context Jeff Layton
[not found] ` <1420742065-28423-5-git-send-email-jlayton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2015-01-09 14:31 ` Christoph Hellwig [this message]
2015-01-09 14:47 ` Jeff Layton
2015-01-08 18:34 ` [PATCH v2 05/10] locks: convert posix " Jeff Layton
2015-01-08 18:34 ` [PATCH v2 07/10] locks: remove i_flock field from struct inode Jeff Layton
2015-01-08 18:34 ` [PATCH v2 08/10] locks: add a dedicated spinlock to protect i_flctx lists Jeff Layton
[not found] ` <1420742065-28423-1-git-send-email-jlayton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2015-01-08 18:34 ` [PATCH v2 06/10] locks: convert lease handling to file_lock_context Jeff Layton
2015-01-08 18:34 ` [PATCH v2 09/10] locks: clean up the lm_change prototype Jeff Layton
2015-01-08 18:34 ` [PATCH v2 10/10] locks: keep a count of locks on the flctx lists Jeff Layton
2015-01-09 17:21 ` [PATCH v2 00/10] locks: saner method for managing file locks Christoph Hellwig
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=20150109143155.GB30294@infradead.org \
--to=hch-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
--cc=ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jlayton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org \
--cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@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;
as well as URLs for NNTP newsgroup(s).