flock.c (5e2aa2ed08e2e280121dc7cf5609c87d464f12ef) flock.c (5955102c9984fa081b2d570cfac75c97eecf8f3b)
1/* AFS file locking support
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 469 unchanged lines hidden (view full) ---

478 struct afs_vnode *vnode = AFS_FS_I(file->f_mapping->host);
479 struct key *key = file->private_data;
480 int ret, lock_count;
481
482 _enter("");
483
484 fl->fl_type = F_UNLCK;
485
1/* AFS file locking support
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 469 unchanged lines hidden (view full) ---

478 struct afs_vnode *vnode = AFS_FS_I(file->f_mapping->host);
479 struct key *key = file->private_data;
480 int ret, lock_count;
481
482 _enter("");
483
484 fl->fl_type = F_UNLCK;
485
486 mutex_lock(&vnode->vfs_inode.i_mutex);
486 inode_lock(&vnode->vfs_inode);
487
488 /* check local lock records first */
489 ret = 0;
490 posix_test_lock(file, fl);
491 if (fl->fl_type == F_UNLCK) {
492 /* no local locks; consult the server */
493 ret = afs_vnode_fetch_status(vnode, NULL, key);
494 if (ret < 0)

--- 5 unchanged lines hidden (view full) ---

500 else
501 fl->fl_type = F_WRLCK;
502 fl->fl_start = 0;
503 fl->fl_end = OFFSET_MAX;
504 }
505 }
506
507error:
487
488 /* check local lock records first */
489 ret = 0;
490 posix_test_lock(file, fl);
491 if (fl->fl_type == F_UNLCK) {
492 /* no local locks; consult the server */
493 ret = afs_vnode_fetch_status(vnode, NULL, key);
494 if (ret < 0)

--- 5 unchanged lines hidden (view full) ---

500 else
501 fl->fl_type = F_WRLCK;
502 fl->fl_start = 0;
503 fl->fl_end = OFFSET_MAX;
504 }
505 }
506
507error:
508 mutex_unlock(&vnode->vfs_inode.i_mutex);
508 inode_unlock(&vnode->vfs_inode);
509 _leave(" = %d [%hd]", ret, fl->fl_type);
510 return ret;
511}
512
513/*
514 * manage POSIX locks on a file
515 */
516int afs_lock(struct file *file, int cmd, struct file_lock *fl)

--- 69 unchanged lines hidden ---
509 _leave(" = %d [%hd]", ret, fl->fl_type);
510 return ret;
511}
512
513/*
514 * manage POSIX locks on a file
515 */
516int afs_lock(struct file *file, int cmd, struct file_lock *fl)

--- 69 unchanged lines hidden ---