亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? svcsubs.c

?? Linux中關于遠程文件鎖定的支持的源代碼
?? C
字號:
/* * linux/fs/lockd/svcsubs.c * * Various support routines for the NLM server. * * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> */#include <linux/types.h>#include <linux/string.h>#include <linux/time.h>#include <linux/in.h>#include <linux/mutex.h>#include <linux/sunrpc/svc.h>#include <linux/sunrpc/clnt.h>#include <linux/nfsd/nfsfh.h>#include <linux/nfsd/export.h>#include <linux/lockd/lockd.h>#include <linux/lockd/share.h>#include <linux/module.h>#include <linux/mount.h>#define NLMDBG_FACILITY		NLMDBG_SVCSUBS/* * Global file hash table */#define FILE_HASH_BITS		7#define FILE_NRHASH		(1<<FILE_HASH_BITS)static struct hlist_head	nlm_files[FILE_NRHASH];static DEFINE_MUTEX(nlm_file_mutex);#ifdef NFSD_DEBUGstatic inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f){	u32 *fhp = (u32*)f->data;	/* print the first 32 bytes of the fh */	dprintk("lockd: %s (%08x %08x %08x %08x %08x %08x %08x %08x)\n",		msg, fhp[0], fhp[1], fhp[2], fhp[3],		fhp[4], fhp[5], fhp[6], fhp[7]);}static inline void nlm_debug_print_file(char *msg, struct nlm_file *file){	struct inode *inode = file->f_file->f_path.dentry->d_inode;	dprintk("lockd: %s %s/%ld\n",		msg, inode->i_sb->s_id, inode->i_ino);}#elsestatic inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f){	return;}static inline void nlm_debug_print_file(char *msg, struct nlm_file *file){	return;}#endifstatic inline unsigned int file_hash(struct nfs_fh *f){	unsigned int tmp=0;	int i;	for (i=0; i<NFS2_FHSIZE;i++)		tmp += f->data[i];	return tmp & (FILE_NRHASH - 1);}/* * Lookup file info. If it doesn't exist, create a file info struct * and open a (VFS) file for the given inode. * * FIXME: * Note that we open the file O_RDONLY even when creating write locks. * This is not quite right, but for now, we assume the client performs * the proper R/W checking. */__be32nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,					struct nfs_fh *f){	struct hlist_node *pos;	struct nlm_file	*file;	unsigned int	hash;	__be32		nfserr;	nlm_debug_print_fh("nlm_lookup_file", f);	hash = file_hash(f);	/* Lock file table */	mutex_lock(&nlm_file_mutex);	hlist_for_each_entry(file, pos, &nlm_files[hash], f_list)		if (!nfs_compare_fh(&file->f_handle, f))			goto found;	nlm_debug_print_fh("creating file for", f);	nfserr = nlm_lck_denied_nolocks;	file = kzalloc(sizeof(*file), GFP_KERNEL);	if (!file)		goto out_unlock;	memcpy(&file->f_handle, f, sizeof(struct nfs_fh));	mutex_init(&file->f_mutex);	INIT_HLIST_NODE(&file->f_list);	INIT_LIST_HEAD(&file->f_blocks);	/* Open the file. Note that this must not sleep for too long, else	 * we would lock up lockd:-) So no NFS re-exports, folks.	 *	 * We have to make sure we have the right credential to open	 * the file.	 */	if ((nfserr = nlmsvc_ops->fopen(rqstp, f, &file->f_file)) != 0) {		dprintk("lockd: open failed (error %d)\n", nfserr);		goto out_free;	}	hlist_add_head(&file->f_list, &nlm_files[hash]);found:	dprintk("lockd: found file %p (count %d)\n", file, file->f_count);	*result = file;	file->f_count++;	nfserr = 0;out_unlock:	mutex_unlock(&nlm_file_mutex);	return nfserr;out_free:	kfree(file);	goto out_unlock;}/* * Delete a file after having released all locks, blocks and shares */static inline voidnlm_delete_file(struct nlm_file *file){	nlm_debug_print_file("closing file", file);	if (!hlist_unhashed(&file->f_list)) {		hlist_del(&file->f_list);		nlmsvc_ops->fclose(file->f_file);		kfree(file);	} else {		printk(KERN_WARNING "lockd: attempt to release unknown file!\n");	}}/* * Loop over all locks on the given file and perform the specified * action. */static intnlm_traverse_locks(struct nlm_host *host, struct nlm_file *file,			nlm_host_match_fn_t match){	struct inode	 *inode = nlmsvc_file_inode(file);	struct file_lock *fl;	struct nlm_host	 *lockhost;again:	file->f_locks = 0;	for (fl = inode->i_flock; fl; fl = fl->fl_next) {		if (fl->fl_lmops != &nlmsvc_lock_operations)			continue;		/* update current lock count */		file->f_locks++;		lockhost = (struct nlm_host *) fl->fl_owner;		if (match(lockhost, host)) {			struct file_lock lock = *fl;			lock.fl_type  = F_UNLCK;			lock.fl_start = 0;			lock.fl_end   = OFFSET_MAX;			if (vfs_lock_file(file->f_file, F_SETLK, &lock, NULL) < 0) {				printk("lockd: unlock failure in %s:%d\n",						__FILE__, __LINE__);				return 1;			}			goto again;		}	}	return 0;}static intnlmsvc_always_match(void *dummy1, struct nlm_host *dummy2){	return 1;}/* * Inspect a single file */static inline intnlm_inspect_file(struct nlm_host *host, struct nlm_file *file, nlm_host_match_fn_t match){	nlmsvc_traverse_blocks(host, file, match);	nlmsvc_traverse_shares(host, file, match);	return nlm_traverse_locks(host, file, match);}/* * Quick check whether there are still any locks, blocks or * shares on a given file. */static inline intnlm_file_inuse(struct nlm_file *file){	struct inode	 *inode = nlmsvc_file_inode(file);	struct file_lock *fl;	if (file->f_count || !list_empty(&file->f_blocks) || file->f_shares)		return 1;	for (fl = inode->i_flock; fl; fl = fl->fl_next) {		if (fl->fl_lmops == &nlmsvc_lock_operations)			return 1;	}	file->f_locks = 0;	return 0;}/* * Loop over all files in the file table. */static intnlm_traverse_files(void *data, nlm_host_match_fn_t match,		int (*is_failover_file)(void *data, struct nlm_file *file)){	struct hlist_node *pos, *next;	struct nlm_file	*file;	int i, ret = 0;	mutex_lock(&nlm_file_mutex);	for (i = 0; i < FILE_NRHASH; i++) {		hlist_for_each_entry_safe(file, pos, next, &nlm_files[i], f_list) {			if (is_failover_file && !is_failover_file(data, file))				continue;			file->f_count++;			mutex_unlock(&nlm_file_mutex);			/* Traverse locks, blocks and shares of this file			 * and update file->f_locks count */			if (nlm_inspect_file(data, file, match))				ret = 1;			mutex_lock(&nlm_file_mutex);			file->f_count--;			/* No more references to this file. Let go of it. */			if (list_empty(&file->f_blocks) && !file->f_locks			 && !file->f_shares && !file->f_count) {				hlist_del(&file->f_list);				nlmsvc_ops->fclose(file->f_file);				kfree(file);			}		}	}	mutex_unlock(&nlm_file_mutex);	return ret;}/* * Release file. If there are no more remote locks on this file, * close it and free the handle. * * Note that we can't do proper reference counting without major * contortions because the code in fs/locks.c creates, deletes and * splits locks without notification. Our only way is to walk the * entire lock list each time we remove a lock. */voidnlm_release_file(struct nlm_file *file){	dprintk("lockd: nlm_release_file(%p, ct = %d)\n",				file, file->f_count);	/* Lock file table */	mutex_lock(&nlm_file_mutex);	/* If there are no more locks etc, delete the file */	if (--file->f_count == 0 && !nlm_file_inuse(file))		nlm_delete_file(file);	mutex_unlock(&nlm_file_mutex);}/* * Helpers function for resource traversal * * nlmsvc_mark_host: *	used by the garbage collector; simply sets h_inuse. *	Always returns 0. * * nlmsvc_same_host: *	returns 1 iff the two hosts match. Used to release *	all resources bound to a specific host. * * nlmsvc_is_client: *	returns 1 iff the host is a client. *	Used by nlmsvc_invalidate_all */static intnlmsvc_mark_host(void *data, struct nlm_host *dummy){	struct nlm_host *host = data;	host->h_inuse = 1;	return 0;}static intnlmsvc_same_host(void *data, struct nlm_host *other){	struct nlm_host *host = data;	return host == other;}static intnlmsvc_is_client(void *data, struct nlm_host *dummy){	struct nlm_host *host = data;	if (host->h_server) {		/* we are destroying locks even though the client		 * hasn't asked us too, so don't unmonitor the		 * client		 */		if (host->h_nsmhandle)			host->h_nsmhandle->sm_sticky = 1;		return 1;	} else		return 0;}/* * Mark all hosts that still hold resources */voidnlmsvc_mark_resources(void){	dprintk("lockd: nlmsvc_mark_resources\n");	nlm_traverse_files(NULL, nlmsvc_mark_host, NULL);}/* * Release all resources held by the given client */voidnlmsvc_free_host_resources(struct nlm_host *host){	dprintk("lockd: nlmsvc_free_host_resources\n");	if (nlm_traverse_files(host, nlmsvc_same_host, NULL)) {		printk(KERN_WARNING			"lockd: couldn't remove all locks held by %s\n",			host->h_name);		BUG();	}}/** * nlmsvc_invalidate_all - remove all locks held for clients * * Release all locks held by NFS clients. * */voidnlmsvc_invalidate_all(void){	/*	 * Previously, the code would call	 * nlmsvc_free_host_resources for each client in	 * turn, which is about as inefficient as it gets.	 * Now we just do it once in nlm_traverse_files.	 */	nlm_traverse_files(NULL, nlmsvc_is_client, NULL);}static intnlmsvc_match_sb(void *datap, struct nlm_file *file){	struct super_block *sb = datap;	return sb == file->f_file->f_path.mnt->mnt_sb;}/** * nlmsvc_unlock_all_by_sb - release locks held on this file system * @sb: super block * * Release all locks held by clients accessing this file system. */intnlmsvc_unlock_all_by_sb(struct super_block *sb){	int ret;	ret = nlm_traverse_files(sb, nlmsvc_always_match, nlmsvc_match_sb);	return ret ? -EIO : 0;}EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_sb);static intnlmsvc_match_ip(void *datap, struct nlm_host *host){	return nlm_cmp_addr(nlm_srcaddr(host), datap);}/** * nlmsvc_unlock_all_by_ip - release local locks by IP address * @server_addr: server's IP address as seen by clients * * Release all locks held by clients accessing this host * via the passed in IP address. */intnlmsvc_unlock_all_by_ip(struct sockaddr *server_addr){	int ret;	ret = nlm_traverse_files(server_addr, nlmsvc_match_ip, NULL);	return ret ? -EIO : 0;}EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_ip);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产百合女同互慰| ...xxx性欧美| 久久在线免费观看| 欧美国产在线观看| 艳妇臀荡乳欲伦亚洲一区| 99视频国产精品| 精品视频999| 久久久精品欧美丰满| 一个色综合av| 国产一区二区三区久久久| 99re在线视频这里只有精品| 欧美日韩国产另类一区| 久久久精品国产免大香伊| 一区二区在线观看免费视频播放| 蜜臀久久99精品久久久久宅男 | 欧美三级在线播放| 国产亚洲成aⅴ人片在线观看| 亚洲精品视频免费观看| 国产一区二区看久久| 久久综合色8888| 一区二区在线观看视频| 精品一区二区三区蜜桃| 在线视频你懂得一区| 国产欧美日韩亚州综合 | 国产一区二区看久久| 欧美精品视频www在线观看 | 日本韩国一区二区三区视频| 7799精品视频| 国产精品久久久久久久久图文区| 日本vs亚洲vs韩国一区三区二区| 成a人片亚洲日本久久| 欧美精品一区二区三区四区| 午夜激情一区二区| 9人人澡人人爽人人精品| 欧美极品少妇xxxxⅹ高跟鞋 | 99re这里只有精品视频首页| 中文字幕免费不卡在线| 国产成人一区在线| 国产精品日日摸夜夜摸av| 国产美女主播视频一区| 精品88久久久久88久久久| 免费成人在线视频观看| 欧美大片拔萝卜| 国产另类ts人妖一区二区| 久久久久久久久蜜桃| 国产一区三区三区| 精品国产精品一区二区夜夜嗨| 激情丁香综合五月| 天天色天天操综合| 91精品国产一区二区三区香蕉| 亚洲狠狠爱一区二区三区| 欧美女孩性生活视频| 国内精品伊人久久久久av影院| 精品国产一区二区三区久久久蜜月| 免费xxxx性欧美18vr| 久久精品亚洲国产奇米99 | 在线不卡中文字幕| 美女被吸乳得到大胸91| 久久久久久久久伊人| 欧美又粗又大又爽| 日本高清不卡视频| 精品一区免费av| 亚洲精品视频在线观看免费| 91精品国产全国免费观看| 成人在线视频一区二区| 亚洲一区在线播放| 久久久久久99久久久精品网站| 色综合激情五月| 韩国视频一区二区| 亚洲综合偷拍欧美一区色| 亚洲精品在线观看网站| 欧美亚洲尤物久久| 成人av先锋影音| 国产制服丝袜一区| 一卡二卡三卡日韩欧美| 日本一区二区三区在线观看| 91精品久久久久久蜜臀| 91免费视频网| eeuss影院一区二区三区| 久久草av在线| 日本va欧美va瓶| 午夜日韩在线电影| 亚洲嫩草精品久久| 中文字幕av资源一区| 欧美成人精品高清在线播放| 欧美日本在线观看| 日本精品裸体写真集在线观看| 岛国精品在线观看| 国产美女娇喘av呻吟久久| 日韩成人dvd| 亚洲777理论| 偷拍一区二区三区四区| 亚洲第一成年网| 亚洲二区在线视频| 日韩国产精品久久久久久亚洲| 亚洲乱码国产乱码精品精可以看| 国产精品对白交换视频| 中文字幕一区三区| 亚洲欧美怡红院| 日韩一区有码在线| 一区二区三区在线免费观看| 亚洲品质自拍视频网站| 亚洲va国产va欧美va观看| 日韩综合一区二区| 激情综合色综合久久综合| 国产乱子伦一区二区三区国色天香 | 国产精品福利一区二区三区| 自拍偷拍国产精品| 天天综合色天天综合| 美国毛片一区二区三区| 国产一区二区毛片| 色天使色偷偷av一区二区| 69精品人人人人| 久久久国产精品麻豆| 国产精品成人网| 中文字幕日韩欧美一区二区三区| 亚洲精品中文字幕乱码三区| 日本系列欧美系列| 国产成人在线观看| 337p亚洲精品色噜噜狠狠| 久久久久久99精品| 亚洲mv大片欧洲mv大片精品| 国产成人亚洲精品狼色在线| 精品视频在线看| 欧美经典一区二区三区| 午夜精品福利久久久| a亚洲天堂av| 欧美精品一区二区不卡| 香蕉av福利精品导航| 成人va在线观看| 久久综合视频网| 国产自产v一区二区三区c| 欧美专区日韩专区| 亚洲美女区一区| 国产盗摄一区二区| 在线不卡中文字幕| 亚洲最色的网站| 色综合一个色综合亚洲| 国产清纯美女被跳蛋高潮一区二区久久w| 一区二区三区在线免费视频| 99久久伊人精品| 国产亚洲欧美色| 国产最新精品免费| 2021中文字幕一区亚洲| 韩国女主播成人在线| 欧美va亚洲va在线观看蝴蝶网| 天天色图综合网| 欧美顶级少妇做爰| 久久精品国产成人一区二区三区| 欧美伊人久久久久久久久影院| 一区二区三区高清不卡| 欧美乱熟臀69xxxxxx| 亚洲一二三区不卡| 欧美日韩成人综合在线一区二区| 亚洲国产精品久久人人爱蜜臀| 91精彩视频在线观看| 婷婷激情综合网| 精品国产成人系列| 成人激情免费电影网址| 久久精品一区蜜桃臀影院| 国产精品污网站| 成人h动漫精品一区二区| 日本一区二区视频在线| 91欧美一区二区| 婷婷国产在线综合| 国产亚洲视频系列| av成人动漫在线观看| 午夜精品福利一区二区蜜股av| 欧美成人一区二区| av中文字幕一区| 日韩1区2区3区| 欧美韩国一区二区| 欧美性受xxxx黑人xyx性爽| 老鸭窝一区二区久久精品| 中文字幕亚洲欧美在线不卡| 555夜色666亚洲国产免| 国产寡妇亲子伦一区二区| 亚洲一区二区三区国产| 国产三级精品在线| 制服丝袜亚洲色图| 播五月开心婷婷综合| 老司机精品视频线观看86 | 在线综合视频播放| 99国产精品99久久久久久| 国模少妇一区二区三区| 亚洲一区二区欧美激情| 日本一二三不卡| 久久午夜国产精品| 欧美日韩国产影片| 97se亚洲国产综合自在线| 国产在线精品不卡| 日韩国产高清在线| 亚洲一区在线观看免费观看电影高清 | 国产黄色精品网站| 另类的小说在线视频另类成人小视频在线 | 91小视频在线| 成人黄色av电影| 成人高清视频在线| 成人黄色777网| 97se亚洲国产综合在线|