mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	NFSv4.2: handle NFS-specific llseek errors
Handle NFS-specific llseek errors instead of letting them leak out to userspace. Reported-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
		
							parent
							
								
									d4c30454db
								
							
						
					
					
						commit
						bdcc2cd14e
					
				
					 1 changed files with 18 additions and 1 deletions
				
			
		| 
						 | 
					@ -135,7 +135,7 @@ int nfs42_proc_deallocate(struct file *filep, loff_t offset, loff_t len)
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
 | 
					static loff_t _nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct inode *inode = file_inode(filep);
 | 
						struct inode *inode = file_inode(filep);
 | 
				
			||||||
	struct nfs42_seek_args args = {
 | 
						struct nfs42_seek_args args = {
 | 
				
			||||||
| 
						 | 
					@ -171,6 +171,23 @@ loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
 | 
				
			||||||
	return vfs_setpos(filep, res.sr_offset, inode->i_sb->s_maxbytes);
 | 
						return vfs_setpos(filep, res.sr_offset, inode->i_sb->s_maxbytes);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nfs_server *server = NFS_SERVER(file_inode(filep));
 | 
				
			||||||
 | 
						struct nfs4_exception exception = { };
 | 
				
			||||||
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						do {
 | 
				
			||||||
 | 
							err = _nfs42_proc_llseek(filep, offset, whence);
 | 
				
			||||||
 | 
							if (err == -ENOTSUPP)
 | 
				
			||||||
 | 
								return -EOPNOTSUPP;
 | 
				
			||||||
 | 
							err = nfs4_handle_exception(server, err, &exception);
 | 
				
			||||||
 | 
						} while (exception.retry);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return err;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
nfs42_layoutstat_prepare(struct rpc_task *task, void *calldata)
 | 
					nfs42_layoutstat_prepare(struct rpc_task *task, void *calldata)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue