Lines Matching full:file
3 * File operations used by nfsd. Some of these have been ripped from
18 #include <linux/file.h>
296 * @fhp: the file handle of the directory
330 * Note: we compose the file handle now, but as the
443 * Changing the size of a file with SETATTR indirectly
486 * nfsd_setattr - Set various file attributes.
525 * the owner of the file, and the caller is not privileged. In this
553 * The size case is special, it changes the file in addition to the
554 * attributes, and file systems don't expect it to be mixed with
612 * modified, but the server changed only the file mode).
665 struct file *src = nf_src->nf_file;
666 struct file *dst = nf_dst->nf_file;
707 ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst,
730 struct file *file, loff_t offset, loff_t len,
735 if (!S_ISREG(file_inode(file)->i_mode))
738 error = vfs_fallocate(file, flags, offset, len);
747 * Check server access rights to a file system object
870 * Open an existing file or directory.
876 __nfsd_open(struct svc_fh *fhp, umode_t type, int may_flags, struct file **filp)
880 struct file *file;
905 file = dentry_open(&path, flags, current_cred());
906 if (IS_ERR(file)) {
907 host_err = PTR_ERR(file);
911 host_err = security_file_post_open(file, may_flags);
913 fput(file);
917 *filp = file;
924 int may_flags, struct file **filp)
958 * nfsd_open_verified - Open a regular file for the filecache
959 * @fhp: NFS filehandle of the file to open
961 * @filp: OUT: open "struct file *"
966 nfsd_open_verified(struct svc_fh *fhp, int may_flags, struct file **filp)
972 * Grab and keep cached pages associated with a file in the svc_rqst
1014 static u32 nfsd_eof_on_read(struct file *file, loff_t offset, ssize_t len,
1019 if (offset+len >= i_size_read(file_inode(file)))
1025 struct file *file, loff_t offset,
1032 *eof = nfsd_eof_on_read(file, offset, host_err, *count);
1034 fsnotify_access(file);
1046 * @fhp: file handle of file to be read
1047 * @file: opened struct file of file to be read
1050 * @eof: OUT: set non-zero if operation reached the end of the file
1056 struct file *file, loff_t offset, unsigned long *count,
1068 host_err = rw_verify_area(READ, file, &offset, *count);
1070 host_err = splice_direct_to_actor(file, &sd,
1072 return nfsd_finish_read(rqstp, fhp, file, offset, count, eof, host_err);
1078 * @fhp: file handle of file to be read
1079 * @file: opened struct file of file to be read
1083 * @eof: OUT: set non-zero if operation reached the end of the file
1092 struct file *file, loff_t offset, unsigned long *count,
1101 init_sync_kiocb(&kiocb, file);
1118 host_err = vfs_iocb_iter_read(file, &kiocb, &iter);
1119 return nfsd_finish_read(rqstp, fhp, file, offset, count, eof, host_err);
1123 * Gathered writes: If another process is currently writing to the file,
1125 * from a client's biod). Rather than syncing the file with each write
1136 static int wait_for_concurrent_writes(struct file *file)
1138 struct inode *inode = file_inode(file);
1152 err = vfs_fsync(file, 0);
1160 * nfsd_vfs_write - write data to an already-open file
1162 * @fhp: File handle of file to write into
1163 * @nf: An open file matching @fhp
1182 struct file *file = nf->nf_file;
1183 struct super_block *sb = file_inode(file)->i_sb;
1217 init_sync_kiocb(&kiocb, file);
1224 since = READ_ONCE(file->f_wb_err);
1227 host_err = vfs_iocb_iter_write(file, &kiocb, &iter);
1234 fsnotify_modify(file);
1235 host_err = filemap_check_wb_err(file->f_mapping, since);
1240 host_err = wait_for_concurrent_writes(file);
1285 * nfsd_read - Read data from a file
1287 * @fhp: file handle of file to be read
1290 * @eof: OUT: set non-zero if operation reached the end of the file
1304 struct file *file;
1312 file = nf->nf_file;
1313 if (file->f_op->splice_read && nfsd_read_splice_ok(rqstp))
1314 err = nfsd_splice_read(rqstp, fhp, file, offset, count, eof);
1316 err = nfsd_iter_read(rqstp, fhp, file, offset, count, 0, eof);
1324 * nfsd_write - open a file and write data to it
1326 * @fhp: File handle of file to write into; nfsd_write() may modify it
1364 * @nf: target file
1365 * @offset: raw offset from beginning of file
1374 * Unfortunately we cannot lock the file to make sure we return full WCC
1394 * outside the maximum file size of the underlying FS,
1434 * nfsd_create_setattr - Set a created file's attributes
1450 * Mode has already been set by file creation.
1463 * Callers expect new file metadata to be committed even
1488 /* HPUX client sometimes creates a file in mode 000, and sets size to 0.
1489 * setting size to 0 may fail for some specific file systems by the permission
1491 * we ignore the resizing(to 0) on the just new created file, since the size is
1492 * 0 after file created.
1559 printk(KERN_WARNING "nfsd: bad file type %o in nfsd_create\n",
1746 * @ffhp: the file handle of the directory where the new link is to be created
1749 * @tfhp: the file handle of an existing file object
1862 * @ffhp: the file handle of parent directory containing the entry to be renamed
1865 * @tfhp: the file handle of parent directory to contain the renamed entry
2022 * @fhp: the file handle of the parent directory to be modified
2023 * @type: enforced file type of the object to be removed
2122 * We do this buffering because we must not call back into the file
2124 * deadlock a number of file systems.
2168 static __be32 nfsd_buffered_readdir(struct file *file, struct svc_fh *fhp,
2193 host_err = iterate_dir(file, &buf.ctx);
2226 offset = vfs_llseek(file, 0, SEEK_CUR);
2241 * @fhp: NFS file handle of directory to be read
2248 * NB: normal system calls hold file->f_pos_lock when calling
2250 * Because the struct file acquired here is not visible to other
2261 struct file *file;
2265 err = nfsd_open(rqstp, fhp, S_IFDIR, may_flags, &file);
2270 file->f_mode |= FMODE_64BITHASH;
2272 file->f_mode |= FMODE_32BITHASH;
2274 offset = vfs_llseek(file, offset, SEEK_SET);
2280 err = nfsd_buffered_readdir(file, fhp, func, cdp, offsetp);
2285 nfsd_filp_close(file);
2291 * nfsd_filp_close: close a file synchronously
2292 * @fp: the file to close
2296 * file, the that finalisation happens immediately, rather then
2299 * When a user-space process closes a file (even when using
2312 * of any file, socket, or device driver would have any cause to wait
2315 void nfsd_filp_close(struct file *fp)
2323 * Get file system stats
2359 * file has too many extended attributes to retrieve inside an
2617 /* Normally we reject any write/sattr etc access on a read-only file
2619 * device special file, we ignore rofs.
2633 * The file owner always gets access permission for accesses that
2635 * file access work even when the client has done a fchmod(fd, 0).
2639 * attempts to truncate a read-only file, because a creat() call
2640 * always implies file truncation.
2642 * ftruncate on an open file descriptor on a file with perm 000.