Loading fs/afs/dir.c +1 −1 Original line number Diff line number Diff line Loading @@ -396,7 +396,7 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx, */ static int afs_readdir(struct file *file, struct dir_context *ctx) { return afs_dir_iterate(file_inode(file), ctx, file->private_data); return afs_dir_iterate(file_inode(file), ctx, afs_file_key(file)); } /* Loading fs/afs/file.c +28 −11 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ const struct address_space_operations afs_fs_aops = { int afs_open(struct inode *inode, struct file *file) { struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_file *af; struct key *key; int ret; Loading @@ -75,19 +76,32 @@ int afs_open(struct inode *inode, struct file *file) key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) { _leave(" = %ld [key]", PTR_ERR(key)); return PTR_ERR(key); ret = PTR_ERR(key); goto error; } ret = afs_validate(vnode, key); if (ret < 0) { _leave(" = %d [val]", ret); return ret; af = kzalloc(sizeof(*af), GFP_KERNEL); if (!af) { ret = -ENOMEM; goto error_key; } file->private_data = key; ret = afs_validate(vnode, key); if (ret < 0) goto error_af; af->key = key; file->private_data = af; _leave(" = 0"); return 0; error_af: kfree(af); error_key: key_put(key); error: _leave(" = %d", ret); return ret; } /* Loading @@ -96,10 +110,13 @@ int afs_open(struct inode *inode, struct file *file) int afs_release(struct inode *inode, struct file *file) { struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_file *af = file->private_data; _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode); key_put(file->private_data); file->private_data = NULL; key_put(af->key); kfree(af); _leave(" = 0"); return 0; } Loading Loading @@ -295,7 +312,7 @@ static int afs_readpage(struct file *file, struct page *page) int ret; if (file) { key = file->private_data; key = afs_file_key(file); ASSERT(key != NULL); ret = afs_page_filler(key, page); } else { Loading Loading @@ -346,7 +363,7 @@ static int afs_readpages_one(struct file *file, struct address_space *mapping, struct afs_read *req; struct list_head *p; struct page *first, *page; struct key *key = file->private_data; struct key *key = afs_file_key(file); pgoff_t index; int ret, n, i; Loading Loading @@ -442,7 +459,7 @@ static int afs_readpages_one(struct file *file, struct address_space *mapping, static int afs_readpages(struct file *file, struct address_space *mapping, struct list_head *pages, unsigned nr_pages) { struct key *key = file->private_data; struct key *key = afs_file_key(file); struct afs_vnode *vnode; int ret = 0; Loading fs/afs/flock.c +5 −5 Original line number Diff line number Diff line Loading @@ -206,7 +206,7 @@ void afs_lock_work(struct work_struct *work) BUG(); fl = list_entry(vnode->granted_locks.next, struct file_lock, fl_u.afs.link); key = key_get(fl->fl_file->private_data); key = key_get(afs_file_key(fl->fl_file)); spin_unlock(&vnode->lock); ret = afs_extend_lock(vnode, key); Loading Loading @@ -240,7 +240,7 @@ void afs_lock_work(struct work_struct *work) BUG(); fl = list_entry(vnode->pending_locks.next, struct file_lock, fl_u.afs.link); key = key_get(fl->fl_file->private_data); key = key_get(afs_file_key(fl->fl_file)); type = (fl->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; spin_unlock(&vnode->lock); Loading Loading @@ -318,7 +318,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl) struct inode *inode = file_inode(file); struct afs_vnode *vnode = AFS_FS_I(inode); afs_lock_type_t type; struct key *key = file->private_data; struct key *key = afs_file_key(file); int ret; _enter("{%x:%u},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type); Loading Loading @@ -500,7 +500,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl) static int afs_do_unlk(struct file *file, struct file_lock *fl) { struct afs_vnode *vnode = AFS_FS_I(file->f_mapping->host); struct key *key = file->private_data; struct key *key = afs_file_key(file); int ret; _enter("{%x:%u},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type); Loading Loading @@ -535,7 +535,7 @@ static int afs_do_unlk(struct file *file, struct file_lock *fl) static int afs_do_getlk(struct file *file, struct file_lock *fl) { struct afs_vnode *vnode = AFS_FS_I(file->f_mapping->host); struct key *key = file->private_data; struct key *key = afs_file_key(file); int ret, lock_count; _enter(""); Loading fs/afs/inode.c +1 −1 Original line number Diff line number Diff line Loading @@ -520,7 +520,7 @@ int afs_setattr(struct dentry *dentry, struct iattr *attr) } if (attr->ia_valid & ATTR_FILE) { key = attr->ia_file->private_data; key = afs_file_key(attr->ia_file); } else { key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) { Loading fs/afs/internal.h +14 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,20 @@ struct afs_call_type { void (*work)(struct work_struct *work); }; /* * AFS open file information record. Pointed to by file->private_data. */ struct afs_file { struct key *key; /* The key this file was opened with */ }; static inline struct key *afs_file_key(struct file *file) { struct afs_file *af = file->private_data; return af->key; } /* * Record of an outstanding read operation on a vnode. */ Loading Loading
fs/afs/dir.c +1 −1 Original line number Diff line number Diff line Loading @@ -396,7 +396,7 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx, */ static int afs_readdir(struct file *file, struct dir_context *ctx) { return afs_dir_iterate(file_inode(file), ctx, file->private_data); return afs_dir_iterate(file_inode(file), ctx, afs_file_key(file)); } /* Loading
fs/afs/file.c +28 −11 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ const struct address_space_operations afs_fs_aops = { int afs_open(struct inode *inode, struct file *file) { struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_file *af; struct key *key; int ret; Loading @@ -75,19 +76,32 @@ int afs_open(struct inode *inode, struct file *file) key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) { _leave(" = %ld [key]", PTR_ERR(key)); return PTR_ERR(key); ret = PTR_ERR(key); goto error; } ret = afs_validate(vnode, key); if (ret < 0) { _leave(" = %d [val]", ret); return ret; af = kzalloc(sizeof(*af), GFP_KERNEL); if (!af) { ret = -ENOMEM; goto error_key; } file->private_data = key; ret = afs_validate(vnode, key); if (ret < 0) goto error_af; af->key = key; file->private_data = af; _leave(" = 0"); return 0; error_af: kfree(af); error_key: key_put(key); error: _leave(" = %d", ret); return ret; } /* Loading @@ -96,10 +110,13 @@ int afs_open(struct inode *inode, struct file *file) int afs_release(struct inode *inode, struct file *file) { struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_file *af = file->private_data; _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode); key_put(file->private_data); file->private_data = NULL; key_put(af->key); kfree(af); _leave(" = 0"); return 0; } Loading Loading @@ -295,7 +312,7 @@ static int afs_readpage(struct file *file, struct page *page) int ret; if (file) { key = file->private_data; key = afs_file_key(file); ASSERT(key != NULL); ret = afs_page_filler(key, page); } else { Loading Loading @@ -346,7 +363,7 @@ static int afs_readpages_one(struct file *file, struct address_space *mapping, struct afs_read *req; struct list_head *p; struct page *first, *page; struct key *key = file->private_data; struct key *key = afs_file_key(file); pgoff_t index; int ret, n, i; Loading Loading @@ -442,7 +459,7 @@ static int afs_readpages_one(struct file *file, struct address_space *mapping, static int afs_readpages(struct file *file, struct address_space *mapping, struct list_head *pages, unsigned nr_pages) { struct key *key = file->private_data; struct key *key = afs_file_key(file); struct afs_vnode *vnode; int ret = 0; Loading
fs/afs/flock.c +5 −5 Original line number Diff line number Diff line Loading @@ -206,7 +206,7 @@ void afs_lock_work(struct work_struct *work) BUG(); fl = list_entry(vnode->granted_locks.next, struct file_lock, fl_u.afs.link); key = key_get(fl->fl_file->private_data); key = key_get(afs_file_key(fl->fl_file)); spin_unlock(&vnode->lock); ret = afs_extend_lock(vnode, key); Loading Loading @@ -240,7 +240,7 @@ void afs_lock_work(struct work_struct *work) BUG(); fl = list_entry(vnode->pending_locks.next, struct file_lock, fl_u.afs.link); key = key_get(fl->fl_file->private_data); key = key_get(afs_file_key(fl->fl_file)); type = (fl->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; spin_unlock(&vnode->lock); Loading Loading @@ -318,7 +318,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl) struct inode *inode = file_inode(file); struct afs_vnode *vnode = AFS_FS_I(inode); afs_lock_type_t type; struct key *key = file->private_data; struct key *key = afs_file_key(file); int ret; _enter("{%x:%u},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type); Loading Loading @@ -500,7 +500,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl) static int afs_do_unlk(struct file *file, struct file_lock *fl) { struct afs_vnode *vnode = AFS_FS_I(file->f_mapping->host); struct key *key = file->private_data; struct key *key = afs_file_key(file); int ret; _enter("{%x:%u},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type); Loading Loading @@ -535,7 +535,7 @@ static int afs_do_unlk(struct file *file, struct file_lock *fl) static int afs_do_getlk(struct file *file, struct file_lock *fl) { struct afs_vnode *vnode = AFS_FS_I(file->f_mapping->host); struct key *key = file->private_data; struct key *key = afs_file_key(file); int ret, lock_count; _enter(""); Loading
fs/afs/inode.c +1 −1 Original line number Diff line number Diff line Loading @@ -520,7 +520,7 @@ int afs_setattr(struct dentry *dentry, struct iattr *attr) } if (attr->ia_valid & ATTR_FILE) { key = attr->ia_file->private_data; key = afs_file_key(attr->ia_file); } else { key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) { Loading
fs/afs/internal.h +14 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,20 @@ struct afs_call_type { void (*work)(struct work_struct *work); }; /* * AFS open file information record. Pointed to by file->private_data. */ struct afs_file { struct key *key; /* The key this file was opened with */ }; static inline struct key *afs_file_key(struct file *file) { struct afs_file *af = file->private_data; return af->key; } /* * Record of an outstanding read operation on a vnode. */ Loading