Re: [PATCH 10/10] gfs2: nfs lock support for gfs2

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Marc Eshel
Date: Wednesday, December 6, 2006 - 11:47 pm

Here is a rewrite of gdlm_plock_callback(). We still need to add the 
lock cancel.
Marc.

int gdlm_plock_callback(struct plock_op *op)
{
     struct file *file;
     struct file_lock *fl;
     int (*notify)(void *, void *, int) = NULL;
     int rv;

    spin_lock(&ops_lock);
    if (!list_empty(&op->list)) {
        printk(KERN_INFO "plock op on list\n");
        list_del(&op->list);
    }
    spin_unlock(&ops_lock);

    rv = op->info.rv;

    /* check if the following 2 are still valid or make a copy */
    file = op->info.file;
    fl = op->info.fl;
    notify = op->info.callback;

    if (!rv) { /* got fs lock */
        rv = posix_lock_file(file, fl);
        if (rv) { /* did not get posix lock */
            notify(fl, NULL, rv);
            log_error("gdlm_plock: vfs lock error file %p fl %p",
                  file, fl);
            /* XXX: We need to cancel the fs lock here: */
            printk("gfs2 lock posix lock request failed\n");
        }
        else { /* got posix lock */
            if (notify(fl, NULL, 0)) {
                /* XXX: We need to cancel the fs lock here: */
                printk("gfs2 lock granted after lock request failed; 
dangling lock!\n");
            }
        }
    }
    else {  /* did not get fs lock */
        notify(fl, NULL, rv);
    }

    kfree(op);
    return rv;
}


David Teigland wrote:


-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, David Teigland, (Wed Dec 6, 8:49 am)
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, J. Bruce Fields, (Wed Dec 6, 12:57 pm)
Re: [NFS] [PATCH 10/10] gfs2: nfs lock support for gfs2, J. Bruce Fields, (Wed Dec 6, 1:08 pm)
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, David Teigland, (Wed Dec 6, 1:58 pm)
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, J. Bruce Fields, (Wed Dec 6, 2:23 pm)
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, David Teigland, (Wed Dec 6, 2:42 pm)
Re: [NFS] [PATCH 10/10] gfs2: nfs lock support for gfs2, J. Bruce Fields, (Wed Dec 6, 3:00 pm)
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, Marc Eshel, (Wed Dec 6, 11:47 pm)
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, J. Bruce Fields, (Thu Dec 7, 8:23 am)
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, David Teigland, (Thu Dec 7, 8:30 am)
Re: [PATCH 10/10] gfs2: nfs lock support for gfs2, J. Bruce Fields, (Thu Dec 7, 9:21 am)
Re: [NFS] [PATCH 10/10] gfs2: nfs lock support for gfs2, Trond Myklebust, (Thu Dec 7, 11:52 am)
Re: [NFS] [PATCH 10/10] gfs2: nfs lock support for gfs2, J. Bruce Fields, (Fri Dec 8, 10:35 am)