Skip to content

Commit c4fe8ae

Browse files
author
Miklos Szeredi
committed
ovl: remove unneeded ioctls
The FS_IOC_[GS]ETFLAGS/FS_IOC_FS[GS]ETXATTR ioctls are now handled via the fileattr api. The only unconverted filesystem remaining is CIFS and it is not allowed to be overlayed due to case insensitive filenames. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 72227ea commit c4fe8ae

3 files changed

Lines changed: 0 additions & 116 deletions

File tree

fs/overlayfs/file.c

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -491,112 +491,6 @@ static int ovl_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
491491
return ret;
492492
}
493493

494-
static long ovl_real_ioctl(struct file *file, unsigned int cmd,
495-
unsigned long arg)
496-
{
497-
struct fd real;
498-
long ret;
499-
500-
ret = ovl_real_fdget(file, &real);
501-
if (ret)
502-
return ret;
503-
504-
ret = security_file_ioctl(real.file, cmd, arg);
505-
if (!ret) {
506-
/*
507-
* Don't override creds, since we currently can't safely check
508-
* permissions before doing so.
509-
*/
510-
ret = vfs_ioctl(real.file, cmd, arg);
511-
}
512-
513-
fdput(real);
514-
515-
return ret;
516-
}
517-
518-
static long ovl_ioctl_set_flags(struct file *file, unsigned int cmd,
519-
unsigned long arg)
520-
{
521-
long ret;
522-
struct inode *inode = file_inode(file);
523-
524-
if (!inode_owner_or_capable(&init_user_ns, inode))
525-
return -EACCES;
526-
527-
ret = mnt_want_write_file(file);
528-
if (ret)
529-
return ret;
530-
531-
inode_lock(inode);
532-
533-
/*
534-
* Prevent copy up if immutable and has no CAP_LINUX_IMMUTABLE
535-
* capability.
536-
*/
537-
ret = -EPERM;
538-
if (!ovl_has_upperdata(inode) && IS_IMMUTABLE(inode) &&
539-
!capable(CAP_LINUX_IMMUTABLE))
540-
goto unlock;
541-
542-
ret = ovl_maybe_copy_up(file_dentry(file), O_WRONLY);
543-
if (ret)
544-
goto unlock;
545-
546-
ret = ovl_real_ioctl(file, cmd, arg);
547-
548-
ovl_copyflags(ovl_inode_real(inode), inode);
549-
unlock:
550-
inode_unlock(inode);
551-
552-
mnt_drop_write_file(file);
553-
554-
return ret;
555-
556-
}
557-
558-
long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
559-
{
560-
long ret;
561-
562-
switch (cmd) {
563-
case FS_IOC_GETFLAGS:
564-
case FS_IOC_FSGETXATTR:
565-
ret = ovl_real_ioctl(file, cmd, arg);
566-
break;
567-
568-
case FS_IOC_FSSETXATTR:
569-
case FS_IOC_SETFLAGS:
570-
ret = ovl_ioctl_set_flags(file, cmd, arg);
571-
break;
572-
573-
default:
574-
ret = -ENOTTY;
575-
}
576-
577-
return ret;
578-
}
579-
580-
#ifdef CONFIG_COMPAT
581-
long ovl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
582-
{
583-
switch (cmd) {
584-
case FS_IOC32_GETFLAGS:
585-
cmd = FS_IOC_GETFLAGS;
586-
break;
587-
588-
case FS_IOC32_SETFLAGS:
589-
cmd = FS_IOC_SETFLAGS;
590-
break;
591-
592-
default:
593-
return -ENOIOCTLCMD;
594-
}
595-
596-
return ovl_ioctl(file, cmd, arg);
597-
}
598-
#endif
599-
600494
enum ovl_copyop {
601495
OVL_COPY,
602496
OVL_CLONE,
@@ -696,10 +590,6 @@ const struct file_operations ovl_file_operations = {
696590
.mmap = ovl_mmap,
697591
.fallocate = ovl_fallocate,
698592
.fadvise = ovl_fadvise,
699-
.unlocked_ioctl = ovl_ioctl,
700-
#ifdef CONFIG_COMPAT
701-
.compat_ioctl = ovl_compat_ioctl,
702-
#endif
703593
.splice_read = generic_file_splice_read,
704594
.splice_write = iter_file_splice_write,
705595

fs/overlayfs/overlayfs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,6 @@ struct dentry *ovl_create_temp(struct dentry *workdir, struct ovl_cattr *attr);
519519
extern const struct file_operations ovl_file_operations;
520520
int __init ovl_aio_request_cache_init(void);
521521
void ovl_aio_request_cache_destroy(void);
522-
long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
523-
long ovl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
524522
int ovl_fileattr_get(struct dentry *dentry, struct fileattr *fa);
525523
int ovl_fileattr_set(struct user_namespace *mnt_userns,
526524
struct dentry *dentry, struct fileattr *fa);

fs/overlayfs/readdir.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,6 @@ const struct file_operations ovl_dir_operations = {
963963
.llseek = ovl_dir_llseek,
964964
.fsync = ovl_dir_fsync,
965965
.release = ovl_dir_release,
966-
.unlocked_ioctl = ovl_ioctl,
967-
#ifdef CONFIG_COMPAT
968-
.compat_ioctl = ovl_compat_ioctl,
969-
#endif
970966
};
971967

972968
int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list)

0 commit comments

Comments
 (0)