Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8d6c554 authored by David Howells's avatar David Howells Committed by Linus Torvalds
Browse files

AFS: implement file locking



Implement file locking for AFS.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b0fed314
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ kafs-objs := \
	cmservice.o \
	dir.o \
	file.o \
	flock.o \
	fsclient.o \
	inode.o \
	main.o \
+8 −0
Original line number Diff line number Diff line
@@ -37,6 +37,13 @@ typedef enum {
	AFS_FTYPE_SYMLINK	= 3,
} afs_file_type_t;

typedef enum {
	AFS_LOCK_READ		= 0,	/* read lock request */
	AFS_LOCK_WRITE		= 1,	/* write lock request */
} afs_lock_type_t;

#define AFS_LOCKWAIT		(5 * 60) /* time until a lock times out (seconds) */

/*
 * AFS file identifier
 */
@@ -120,6 +127,7 @@ struct afs_file_status {
	struct afs_fid		parent;		/* parent dir ID for non-dirs only */
	time_t			mtime_client;	/* last time client changed data */
	time_t			mtime_server;	/* last time server changed data */
	s32			lock_count;	/* file lock count (0=UNLK -1=WRLCK +ve=#RDLCK */
};

/*
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ enum AFS_FS_Operations {
	FSGETVOLUMEINFO		= 148,	/* AFS Get information about a volume */
	FSGETVOLUMESTATUS	= 149,	/* AFS Get volume status information */
	FSGETROOTVOLUME		= 151,	/* AFS Get root volume name */
	FSSETLOCK		= 156,	/* AFS Request a file lock */
	FSEXTENDLOCK		= 157,	/* AFS Extend a file lock */
	FSRELEASELOCK		= 158,	/* AFS Release a file lock */
	FSLOOKUP		= 161,	/* AFS lookup file in directory */
	FSFETCHDATA64		= 65537, /* AFS Fetch file data */
	FSSTOREDATA64		= 65538, /* AFS Store file data */
+3 −0
Original line number Diff line number Diff line
@@ -125,6 +125,9 @@ static void afs_break_callback(struct afs_server *server,
		spin_unlock(&server->cb_lock);

		queue_work(afs_callback_update_worker, &vnode->cb_broken_work);
		if (list_empty(&vnode->granted_locks) &&
		    !list_empty(&vnode->pending_locks))
			afs_lock_may_be_available(vnode);
		spin_unlock(&vnode->lock);
	}
}
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ const struct file_operations afs_dir_file_operations = {
	.open		= afs_dir_open,
	.release	= afs_release,
	.readdir	= afs_readdir,
	.lock		= afs_lock,
};

const struct inode_operations afs_dir_inode_operations = {
Loading