Linux compat: Minimum kernel version 3.10

Increase the minimum supported kernel version from 2.6.32 to 3.10.
This removes support for the following Linux enterprise distributions.

    Distribution     | Kernel | End of Life
    ---------------- | ------ | -------------
    Ubuntu 12.04 LTS | 3.2    | Apr 28, 2017
    SLES 11          | 3.0    | Mar 32, 2019
    RHEL / CentOS 6  | 2.6.32 | Nov 30, 2020

The following changes were made as part of removing support.

* Updated `configure` to enforce a minimum kernel version as
  specified in the META file (Linux-Minimum: 3.10).

    configure: error:
        *** Cannot build against kernel version 2.6.32.
        *** The minimum supported kernel version is 3.10.

* Removed all `configure` kABI checks and matching C code for
  interfaces which solely predate the Linux 3.10 kernel.

* Updated all `configure` kABI checks to fail when an interface is
  missing which was in the 3.10 kernel up to the latest 5.1 kernel.
  Removed the HAVE_* preprocessor defines for these checks and
  updated the code to unconditionally use the verified interface.

* Inverted the detection logic in several kABI checks to match
  the new interface as it appears in 3.10 and newer and not the
  legacy interface.

* Consolidated the following checks in to individual files. Due
  the large number of changes in the checks it made sense to handle
  this now.  It would be desirable to group other related checks in
  the same fashion, but this as left as future work.

  - config/kernel-blkdev.m4 - Block device kABI checks
  - config/kernel-blk-queue.m4 - Block queue kABI checks
  - config/kernel-bio.m4 - Bio interface kABI checks

* Removed the kABI checks for sops->nr_cached_objects() and
  sops->free_cached_objects().  These interfaces are currently unused.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9566
This commit is contained in:
Brian Behlendorf
2019-11-12 08:59:06 -08:00
committed by GitHub
parent 035ebb3653
commit 066e825221
102 changed files with 1136 additions and 2965 deletions
-4
View File
@@ -27,11 +27,7 @@
#include <sys/cred.h>
static int
#ifdef HAVE_KUIDGID_T
cr_groups_search(const struct group_info *group_info, kgid_t grp)
#else
cr_groups_search(const struct group_info *group_info, gid_t grp)
#endif
{
unsigned int left, right, mid;
int cmp;
-5
View File
@@ -1030,11 +1030,6 @@ spl_kmem_cache_create(char *name, size_t size, size_t align,
goto out;
}
#if defined(HAVE_KMEM_CACHE_ALLOCFLAGS)
skc->skc_linux_cache->allocflags |= __GFP_COMP;
#elif defined(HAVE_KMEM_CACHE_GFPFLAGS)
skc->skc_linux_cache->gfpflags |= __GFP_COMP;
#endif
skc->skc_flags |= KMC_NOMAGAZINE;
}
-3
View File
@@ -712,9 +712,6 @@ static struct ctl_table spl_dir[] = {
static struct ctl_table spl_root[] = {
{
#ifdef HAVE_CTL_NAME
.ctl_name = CTL_KERN,
#endif
.procname = "kernel",
.mode = 0555,
.child = spl_dir,
-38
View File
@@ -48,17 +48,8 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
{
int error = -EOPNOTSUPP;
#ifdef HAVE_FILE_FALLOCATE
if (fp->f_op->fallocate)
error = fp->f_op->fallocate(fp, mode, offset, len);
#else
#ifdef HAVE_INODE_FALLOCATE
if (fp->f_dentry && fp->f_dentry->d_inode &&
fp->f_dentry->d_inode->i_op->fallocate)
error = fp->f_dentry->d_inode->i_op->fallocate(
fp->f_dentry->d_inode, mode, offset, len);
#endif /* HAVE_INODE_FALLOCATE */
#endif /* HAVE_FILE_FALLOCATE */
return (error);
}
@@ -66,11 +57,7 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
static int
spl_filp_fsync(struct file *fp, int sync)
{
#ifdef HAVE_2ARGS_VFS_FSYNC
return (vfs_fsync(fp, sync));
#else
return (vfs_fsync(fp, (fp)->f_dentry, sync));
#endif /* HAVE_2ARGS_VFS_FSYNC */
}
static ssize_t
@@ -456,31 +443,6 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
if (error == 0)
return (0);
#endif
#ifdef HAVE_INODE_TRUNCATE_RANGE
if (vp->v_file->f_dentry && vp->v_file->f_dentry->d_inode &&
vp->v_file->f_dentry->d_inode->i_op &&
vp->v_file->f_dentry->d_inode->i_op->truncate_range) {
off_t end = bfp->l_start + bfp->l_len;
/*
* Judging from the code in shmem_truncate_range(),
* it seems the kernel expects the end offset to be
* inclusive and aligned to the end of a page.
*/
if (end % PAGE_SIZE != 0) {
end &= ~(off_t)(PAGE_SIZE - 1);
if (end <= bfp->l_start)
return (0);
}
--end;
vp->v_file->f_dentry->d_inode->i_op->truncate_range(
vp->v_file->f_dentry->d_inode, bfp->l_start, end);
return (0);
}
#endif
return (error);
}
EXPORT_SYMBOL(vn_space);
+1 -1
View File
@@ -196,7 +196,7 @@ spl_zlib_init(void)
{
int size;
size = MAX(spl_zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
size = MAX(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
zlib_inflate_workspacesize());
zlib_workspace_cache = kmem_cache_create(
-21
View File
@@ -1043,20 +1043,6 @@ abd_release_ownership_of_buf(abd_t *abd)
ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size);
}
#ifndef HAVE_1ARG_KMAP_ATOMIC
#define NR_KM_TYPE (6)
#ifdef _KERNEL
int km_table[NR_KM_TYPE] = {
KM_USER0,
KM_USER1,
KM_BIO_SRC_IRQ,
KM_BIO_DST_IRQ,
KM_PTE0,
KM_PTE1,
};
#endif
#endif
struct abd_iter {
/* public interface */
void *iter_mapaddr; /* addr corresponding to iter_pos */
@@ -1068,9 +1054,6 @@ struct abd_iter {
size_t iter_offset; /* offset in current sg/abd_buf, */
/* abd_offset included */
struct scatterlist *iter_sg; /* current sg */
#ifndef HAVE_1ARG_KMAP_ATOMIC
int iter_km; /* KM_* for kmap_atomic */
#endif
};
/*
@@ -1091,10 +1074,6 @@ abd_iter_init(struct abd_iter *aiter, abd_t *abd, int km_type)
aiter->iter_offset = ABD_SCATTER(abd).abd_offset;
aiter->iter_sg = ABD_SCATTER(abd).abd_sgl;
}
#ifndef HAVE_1ARG_KMAP_ATOMIC
ASSERT3U(km_type, <, NR_KM_TYPE);
aiter->iter_km = km_type;
#endif
}
/*
+9 -10
View File
@@ -50,7 +50,7 @@ priv_policy_ns(const cred_t *cr, int capability, boolean_t all, int err,
if (cr != CRED() && (cr != kcred))
return (err);
#if defined(CONFIG_USER_NS) && defined(HAVE_NS_CAPABLE)
#if defined(CONFIG_USER_NS)
if (!(ns ? ns_capable(ns, capability) : capable(capability)))
#else
if (!capable(capability))
@@ -73,10 +73,9 @@ priv_policy_user(const cred_t *cr, int capability, boolean_t all, int err)
* All priv_policy_user checks are preceded by kuid/kgid_has_mapping()
* checks. If we cannot do them, we shouldn't be using ns_capable()
* since we don't know whether the affected files are valid in our
* namespace. Note that kuid_has_mapping() came after cred->user_ns, so
* we shouldn't need to re-check for HAVE_CRED_USER_NS
* namespace.
*/
#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
#if defined(CONFIG_USER_NS)
return (priv_policy_ns(cr, capability, all, err, cr->user_ns));
#else
return (priv_policy_ns(cr, capability, all, err, NULL));
@@ -127,10 +126,10 @@ secpolicy_vnode_any_access(const cred_t *cr, struct inode *ip, uid_t owner)
if (crgetfsuid(cr) == owner)
return (0);
if (zpl_inode_owner_or_capable(ip))
if (inode_owner_or_capable(ip))
return (0);
#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
#if defined(CONFIG_USER_NS)
if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
return (EPERM);
#endif
@@ -153,7 +152,7 @@ secpolicy_vnode_chown(const cred_t *cr, uid_t owner)
if (crgetfsuid(cr) == owner)
return (0);
#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
#if defined(CONFIG_USER_NS)
if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
return (EPERM);
#endif
@@ -190,7 +189,7 @@ secpolicy_vnode_setdac(const cred_t *cr, uid_t owner)
if (crgetfsuid(cr) == owner)
return (0);
#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
#if defined(CONFIG_USER_NS)
if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
return (EPERM);
#endif
@@ -218,7 +217,7 @@ secpolicy_vnode_setid_retain(const cred_t *cr, boolean_t issuidroot)
int
secpolicy_vnode_setids_setgids(const cred_t *cr, gid_t gid)
{
#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
#if defined(CONFIG_USER_NS)
if (!kgid_has_mapping(cr->user_ns, SGID_TO_KGID(gid)))
return (EPERM);
#endif
@@ -269,7 +268,7 @@ secpolicy_vnode_setid_modify(const cred_t *cr, uid_t owner)
if (crgetfsuid(cr) == owner)
return (0);
#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
#if defined(CONFIG_USER_NS)
if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
return (EPERM);
#endif
+13 -53
View File
@@ -54,8 +54,6 @@ typedef struct dio_request {
struct bio *dr_bio[0]; /* Attached bio's */
} dio_request_t;
#if defined(HAVE_OPEN_BDEV_EXCLUSIVE) || defined(HAVE_BLKDEV_GET_BY_PATH)
static fmode_t
vdev_bdev_mode(int smode)
{
@@ -71,20 +69,6 @@ vdev_bdev_mode(int smode)
return (mode);
}
#else
static int
vdev_bdev_mode(int smode)
{
int mode = 0;
ASSERT3S(smode & (FREAD | FWRITE), !=, 0);
if ((smode & FREAD) && !(smode & FWRITE))
mode = SB_RDONLY;
return (mode);
}
#endif /* HAVE_OPEN_BDEV_EXCLUSIVE */
/*
* Returns the usable capacity (in bytes) for the partition or disk.
@@ -267,14 +251,15 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
reread_part = B_TRUE;
}
vdev_bdev_close(bdev, mode);
blkdev_put(bdev, mode | FMODE_EXCL);
}
if (reread_part) {
bdev = vdev_bdev_open(disk_name, mode, zfs_vdev_holder);
bdev = blkdev_get_by_path(disk_name, mode | FMODE_EXCL,
zfs_vdev_holder);
if (!IS_ERR(bdev)) {
int error = vdev_bdev_reread_part(bdev);
vdev_bdev_close(bdev, mode);
blkdev_put(bdev, mode | FMODE_EXCL);
if (error == 0)
bdev_retry_count = 100;
}
@@ -311,7 +296,8 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
*/
bdev = ERR_PTR(-ENXIO);
while (IS_ERR(bdev) && count < bdev_retry_count) {
bdev = vdev_bdev_open(v->vdev_path, mode, zfs_vdev_holder);
bdev = blkdev_get_by_path(v->vdev_path, mode | FMODE_EXCL,
zfs_vdev_holder);
if (unlikely(PTR_ERR(bdev) == -ENOENT)) {
schedule_timeout(MSEC_TO_TICK(10));
count++;
@@ -336,7 +322,7 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
struct request_queue *q = bdev_get_queue(vd->vd_bdev);
/* Determine the physical block size */
block_size = vdev_bdev_block_size(vd->vd_bdev);
block_size = bdev_physical_block_size(vd->vd_bdev);
/* Clear the nowritecache bit, causes vdev_reopen() to try again. */
v->vdev_nowritecache = B_FALSE;
@@ -374,8 +360,8 @@ vdev_disk_close(vdev_t *v)
return;
if (vd->vd_bdev != NULL) {
vdev_bdev_close(vd->vd_bdev,
vdev_bdev_mode(spa_mode(v->vdev_spa)));
blkdev_put(vd->vd_bdev,
vdev_bdev_mode(spa_mode(v->vdev_spa)) | FMODE_EXCL);
}
rw_destroy(&vd->vd_lock);
@@ -563,17 +549,10 @@ bio_set_dev(struct bio *bio, struct block_device *bdev)
static inline void
vdev_submit_bio(struct bio *bio)
{
#ifdef HAVE_CURRENT_BIO_TAIL
struct bio **bio_tail = current->bio_tail;
current->bio_tail = NULL;
vdev_submit_bio_impl(bio);
current->bio_tail = bio_tail;
#else
struct bio_list *bio_list = current->bio_list;
current->bio_list = NULL;
vdev_submit_bio_impl(bio);
current->bio_list = bio_list;
#endif
}
static int
@@ -585,9 +564,8 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio,
uint64_t bio_offset;
int bio_size, bio_count = 16;
int i = 0, error = 0;
#if defined(HAVE_BLK_QUEUE_HAVE_BLK_PLUG)
struct blk_plug plug;
#endif
/*
* Accessing outside the block device is never allowed.
*/
@@ -666,20 +644,16 @@ retry:
/* Extra reference to protect dio_request during vdev_submit_bio */
vdev_disk_dio_get(dr);
#if defined(HAVE_BLK_QUEUE_HAVE_BLK_PLUG)
if (dr->dr_bio_count > 1)
blk_start_plug(&plug);
#endif
/* Submit all bio's associated with this dio */
for (i = 0; i < dr->dr_bio_count; i++)
if (dr->dr_bio[i])
vdev_submit_bio(dr->dr_bio[i]);
#if defined(HAVE_BLK_QUEUE_HAVE_BLK_PLUG)
if (dr->dr_bio_count > 1)
blk_finish_plug(&plug);
#endif
(void) vdev_disk_dio_put(dr);
@@ -736,7 +710,7 @@ vdev_disk_io_start(zio_t *zio)
vdev_t *v = zio->io_vd;
vdev_disk_t *vd = v->vdev_tsd;
unsigned long trim_flags = 0;
int rw, flags, error;
int rw, error;
/*
* If the vdev is closed, it's likely in the REMOVED or FAULTED state.
@@ -801,24 +775,10 @@ vdev_disk_io_start(zio_t *zio)
return;
case ZIO_TYPE_WRITE:
rw = WRITE;
#if defined(HAVE_BLK_QUEUE_HAVE_BIO_RW_UNPLUG)
flags = (1 << BIO_RW_UNPLUG);
#elif defined(REQ_UNPLUG)
flags = REQ_UNPLUG;
#else
flags = 0;
#endif
break;
case ZIO_TYPE_READ:
rw = READ;
#if defined(HAVE_BLK_QUEUE_HAVE_BIO_RW_UNPLUG)
flags = (1 << BIO_RW_UNPLUG);
#elif defined(REQ_UNPLUG)
flags = REQ_UNPLUG;
#else
flags = 0;
#endif
break;
case ZIO_TYPE_TRIM:
@@ -843,7 +803,7 @@ vdev_disk_io_start(zio_t *zio)
zio->io_target_timestamp = zio_handle_io_delay(zio);
error = __vdev_disk_physio(vd->vd_bdev, zio,
zio->io_size, zio->io_offset, rw, flags);
zio->io_size, zio->io_offset, rw, 0);
rw_exit(&vd->vd_lock);
if (error) {
@@ -866,7 +826,7 @@ vdev_disk_io_done(zio_t *zio)
vdev_disk_t *vd = v->vdev_tsd;
if (check_disk_change(vd->vd_bdev)) {
vdev_bdev_invalidate(vd->vd_bdev);
invalidate_bdev(vd->vd_bdev);
v->vdev_remove_wanted = B_TRUE;
spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE);
}
+1 -1
View File
@@ -1106,7 +1106,7 @@ zfsctl_snapshot_mount(struct path *path, int flags)
*/
spath = *path;
path_get(&spath);
if (zpl_follow_down_one(&spath)) {
if (follow_down_one(&spath)) {
snap_zfsvfs = ITOZSB(spath.dentry->d_inode);
snap_zfsvfs->z_parent = zfsvfs;
dentry = spath.dentry;
+2 -7
View File
@@ -1608,7 +1608,6 @@ zfs_root(zfsvfs_t *zfsvfs, struct inode **ipp)
return (error);
}
#ifdef HAVE_D_PRUNE_ALIASES
/*
* Linux kernels older than 3.1 do not support a per-filesystem shrinker.
* To accommodate this we must improvise and manually walk the list of znodes
@@ -1666,7 +1665,6 @@ zfs_prune_aliases(zfsvfs_t *zfsvfs, unsigned long nr_to_scan)
return (objects);
}
#endif /* HAVE_D_PRUNE_ALIASES */
/*
* The ARC has requested that the filesystem drop entries from the dentry
@@ -1678,13 +1676,11 @@ zfs_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
{
zfsvfs_t *zfsvfs = sb->s_fs_info;
int error = 0;
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
struct shrinker *shrinker = &sb->s_shrink;
struct shrink_control sc = {
.nr_to_scan = nr_to_scan,
.gfp_mask = GFP_KERNEL,
};
#endif
ZFS_ENTER(zfsvfs);
@@ -1702,7 +1698,7 @@ zfs_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
#elif defined(HAVE_SPLIT_SHRINKER_CALLBACK)
*objects = (*shrinker->scan_objects)(shrinker, &sc);
#elif defined(HAVE_SHRINK)
#elif defined(HAVE_SINGLE_SHRINKER_CALLBACK)
*objects = (*shrinker->shrink)(shrinker, &sc);
#elif defined(HAVE_D_PRUNE_ALIASES)
#define D_PRUNE_ALIASES_IS_DEFAULT
@@ -1877,8 +1873,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
return (0);
}
#if !defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \
!defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER)
#if defined(HAVE_SUPER_SETUP_BDI_NAME)
atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0);
#endif
+1 -22
View File
@@ -114,11 +114,7 @@ zpl_root_getattr_impl(const struct path *path, struct kstat *stat,
ZPL_GETATTR_WRAPPER(zpl_root_getattr);
static struct dentry *
#ifdef HAVE_LOOKUP_NAMEIDATA
zpl_root_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd)
#else
zpl_root_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags)
#endif
{
cred_t *cr = CRED();
struct inode *ip;
@@ -160,7 +156,6 @@ const struct inode_operations zpl_ops_root = {
.getattr = zpl_root_getattr,
};
#ifdef HAVE_AUTOMOUNT
static struct vfsmount *
zpl_snapdir_automount(struct path *path)
{
@@ -179,7 +174,6 @@ zpl_snapdir_automount(struct path *path)
*/
return (NULL);
}
#endif /* HAVE_AUTOMOUNT */
/*
* Negative dentries must always be revalidated so newly created snapshots
@@ -206,21 +200,13 @@ dentry_operations_t zpl_dops_snapdirs = {
* name space. While it might be possible to add compatibility
* code to accomplish this it would require considerable care.
*/
#ifdef HAVE_AUTOMOUNT
.d_automount = zpl_snapdir_automount,
#endif /* HAVE_AUTOMOUNT */
.d_revalidate = zpl_snapdir_revalidate,
};
static struct dentry *
#ifdef HAVE_LOOKUP_NAMEIDATA
zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
struct nameidata *nd)
#else
zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
unsigned int flags)
#endif
{
fstrans_cookie_t cookie;
cred_t *cr = CRED();
@@ -241,9 +227,7 @@ zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
ASSERT(error == 0 || ip == NULL);
d_clear_d_op(dentry);
d_set_d_op(dentry, &zpl_dops_snapdirs);
#ifdef HAVE_AUTOMOUNT
dentry->d_flags |= DCACHE_NEED_AUTOMOUNT;
#endif
return (d_splice_alias(ip, dentry));
}
@@ -348,7 +332,7 @@ zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry)
}
static int
zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, zpl_umode_t mode)
zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
{
cred_t *cr = CRED();
vattr_t *vap;
@@ -433,13 +417,8 @@ const struct inode_operations zpl_ops_snapdir = {
};
static struct dentry *
#ifdef HAVE_LOOKUP_NAMEIDATA
zpl_shares_lookup(struct inode *dip, struct dentry *dentry,
struct nameidata *nd)
#else
zpl_shares_lookup(struct inode *dip, struct dentry *dentry,
unsigned int flags)
#endif
{
fstrans_cookie_t cookie;
cred_t *cr = CRED();
+2 -25
View File
@@ -64,25 +64,6 @@ zpl_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable)
return (rc == 0 ? FILEID_INO32_GEN : 255);
}
static struct dentry *
zpl_dentry_obtain_alias(struct inode *ip)
{
struct dentry *result;
#ifdef HAVE_D_OBTAIN_ALIAS
result = d_obtain_alias(ip);
#else
result = d_alloc_anon(ip);
if (result == NULL) {
iput(ip);
result = ERR_PTR(-ENOMEM);
}
#endif /* HAVE_D_OBTAIN_ALIAS */
return (result);
}
static struct dentry *
zpl_fh_to_dentry(struct super_block *sb, struct fid *fh,
int fh_len, int fh_type)
@@ -121,7 +102,7 @@ zpl_fh_to_dentry(struct super_block *sb, struct fid *fh,
ASSERT((ip != NULL) && !IS_ERR(ip));
return (zpl_dentry_obtain_alias(ip));
return (d_obtain_alias(ip));
}
static struct dentry *
@@ -142,10 +123,9 @@ zpl_get_parent(struct dentry *child)
if (error)
return (ERR_PTR(error));
return (zpl_dentry_obtain_alias(ip));
return (d_obtain_alias(ip));
}
#ifdef HAVE_COMMIT_METADATA
static int
zpl_commit_metadata(struct inode *inode)
{
@@ -165,13 +145,10 @@ zpl_commit_metadata(struct inode *inode)
return (error);
}
#endif /* HAVE_COMMIT_METADATA */
const struct export_operations zpl_export_operations = {
.encode_fh = zpl_encode_fh,
.fh_to_dentry = zpl_fh_to_dentry,
.get_parent = zpl_get_parent,
#ifdef HAVE_COMMIT_METADATA
.commit_metadata = zpl_commit_metadata,
#endif /* HAVE_COMMIT_METADATA */
};
+3 -42
View File
@@ -108,40 +108,7 @@ zpl_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
#if defined(HAVE_FSYNC_WITH_DENTRY)
/*
* Linux 2.6.x - 2.6.34 API,
* Through 2.6.34 the nfsd kernel server would pass a NULL 'file struct *'
* to the fops->fsync() hook. For this reason, we must be careful not to
* use filp unconditionally.
*/
static int
zpl_fsync(struct file *filp, struct dentry *dentry, int datasync)
{
cred_t *cr = CRED();
int error;
fstrans_cookie_t cookie;
crhold(cr);
cookie = spl_fstrans_mark();
error = -zfs_fsync(dentry->d_inode, datasync, cr);
spl_fstrans_unmark(cookie);
crfree(cr);
ASSERT3S(error, <=, 0);
return (error);
}
#ifdef HAVE_FILE_AIO_FSYNC
static int
zpl_aio_fsync(struct kiocb *kiocb, int datasync)
{
struct file *filp = kiocb->ki_filp;
return (zpl_fsync(filp, file_dentry(filp), datasync));
}
#endif
#elif defined(HAVE_FSYNC_WITHOUT_DENTRY)
#if defined(HAVE_FSYNC_WITHOUT_DENTRY)
/*
* Linux 2.6.35 - 3.0 API,
* As of 2.6.35 the dentry argument to the fops->fsync() hook was deemed
@@ -758,8 +725,7 @@ zpl_writepage(struct page *pp, struct writeback_control *wbc)
* is FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE. The FALLOC_FL_PUNCH_HOLE
* flag was introduced in the 2.6.38 kernel.
*/
#if defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE)
long
static long
zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
{
int error = -EOPNOTSUPP;
@@ -803,16 +769,13 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
ASSERT3S(error, <=, 0);
return (error);
}
#endif /* defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) */
#ifdef HAVE_FILE_FALLOCATE
static long
zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
{
return zpl_fallocate_common(file_inode(filp),
mode, offset, len);
}
#endif /* HAVE_FILE_FALLOCATE */
#define ZFS_FL_USER_VISIBLE (FS_FL_USER_VISIBLE | ZFS_PROJINHERIT_FL)
#define ZFS_FL_USER_MODIFIABLE (FS_FL_USER_MODIFIABLE | ZFS_PROJINHERIT_FL)
@@ -883,7 +846,7 @@ __zpl_ioctl_setflags(struct inode *ip, uint32_t ioctl_flags, xvattr_t *xva)
!capable(CAP_LINUX_IMMUTABLE))
return (-EACCES);
if (!zpl_inode_owner_or_capable(ip))
if (!inode_owner_or_capable(ip))
return (-EACCES);
xva_init(xva);
@@ -1048,9 +1011,7 @@ const struct file_operations zpl_file_operations = {
#ifdef HAVE_FILE_AIO_FSYNC
.aio_fsync = zpl_aio_fsync,
#endif
#ifdef HAVE_FILE_FALLOCATE
.fallocate = zpl_fallocate,
#endif /* HAVE_FILE_FALLOCATE */
.unlocked_ioctl = zpl_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = zpl_compat_ioctl,
+8 -82
View File
@@ -35,11 +35,7 @@
static struct dentry *
#ifdef HAVE_LOOKUP_NAMEIDATA
zpl_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
#else
zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
#endif
{
cred_t *cr = CRED();
struct inode *ip;
@@ -113,7 +109,7 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
}
void
zpl_vap_init(vattr_t *vap, struct inode *dir, zpl_umode_t mode, cred_t *cr)
zpl_vap_init(vattr_t *vap, struct inode *dir, umode_t mode, cred_t *cr)
{
vap->va_mask = ATTR_MODE;
vap->va_mode = mode;
@@ -129,13 +125,7 @@ zpl_vap_init(vattr_t *vap, struct inode *dir, zpl_umode_t mode, cred_t *cr)
}
static int
#ifdef HAVE_CREATE_NAMEIDATA
zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
struct nameidata *nd)
#else
zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
bool flag)
#endif
zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag)
{
cred_t *cr = CRED();
struct inode *ip;
@@ -169,7 +159,7 @@ zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
}
static int
zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
dev_t rdev)
{
cred_t *cr = CRED();
@@ -213,7 +203,7 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
#ifdef HAVE_TMPFILE
static int
zpl_tmpfile(struct inode *dir, struct dentry *dentry, zpl_umode_t mode)
zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
{
cred_t *cr = CRED();
struct inode *ip;
@@ -277,7 +267,7 @@ zpl_unlink(struct inode *dir, struct dentry *dentry)
}
static int
zpl_mkdir(struct inode *dir, struct dentry *dentry, zpl_umode_t mode)
zpl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
{
cred_t *cr = CRED();
vattr_t *vap;
@@ -612,46 +602,6 @@ out:
return (error);
}
#ifdef HAVE_INODE_TRUNCATE_RANGE
static void
zpl_truncate_range(struct inode *ip, loff_t start, loff_t end)
{
cred_t *cr = CRED();
flock64_t bf;
fstrans_cookie_t cookie;
ASSERT3S(start, <=, end);
/*
* zfs_freesp() will interpret (len == 0) as meaning "truncate until
* the end of the file". We don't want that.
*/
if (start == end)
return;
crhold(cr);
bf.l_type = F_WRLCK;
bf.l_whence = SEEK_SET;
bf.l_start = start;
bf.l_len = end - start;
bf.l_pid = 0;
cookie = spl_fstrans_mark();
zfs_space(ip, F_FREESP, &bf, FWRITE, start, cr);
spl_fstrans_unmark(cookie);
crfree(cr);
}
#endif /* HAVE_INODE_TRUNCATE_RANGE */
#ifdef HAVE_INODE_FALLOCATE
static long
zpl_fallocate(struct inode *ip, int mode, loff_t offset, loff_t len)
{
return (zpl_fallocate_common(ip, mode, offset, len));
}
#endif /* HAVE_INODE_FALLOCATE */
const struct inode_operations zpl_inode_operations = {
.setattr = zpl_setattr,
.getattr = zpl_getattr,
@@ -661,23 +611,11 @@ const struct inode_operations zpl_inode_operations = {
.removexattr = generic_removexattr,
#endif
.listxattr = zpl_xattr_list,
#ifdef HAVE_INODE_TRUNCATE_RANGE
.truncate_range = zpl_truncate_range,
#endif /* HAVE_INODE_TRUNCATE_RANGE */
#ifdef HAVE_INODE_FALLOCATE
.fallocate = zpl_fallocate,
#endif /* HAVE_INODE_FALLOCATE */
#if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl,
#endif
#if defined(HAVE_GET_ACL)
#endif /* HAVE_SET_ACL */
.get_acl = zpl_get_acl,
#elif defined(HAVE_CHECK_ACL)
.check_acl = zpl_check_acl,
#elif defined(HAVE_PERMISSION)
.permission = zpl_permission,
#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
#endif /* CONFIG_FS_POSIX_ACL */
};
@@ -709,14 +647,8 @@ const struct inode_operations zpl_dir_inode_operations = {
#if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl,
#endif
#if defined(HAVE_GET_ACL)
#endif /* HAVE_SET_ACL */
.get_acl = zpl_get_acl,
#elif defined(HAVE_CHECK_ACL)
.check_acl = zpl_check_acl,
#elif defined(HAVE_PERMISSION)
.permission = zpl_permission,
#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
#endif /* CONFIG_FS_POSIX_ACL */
};
@@ -754,13 +686,7 @@ const struct inode_operations zpl_special_inode_operations = {
#if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl,
#endif
#if defined(HAVE_GET_ACL)
#endif /* HAVE_SET_ACL */
.get_acl = zpl_get_acl,
#elif defined(HAVE_CHECK_ACL)
.check_acl = zpl_check_acl,
#elif defined(HAVE_PERMISSION)
.permission = zpl_permission,
#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
#endif /* CONFIG_FS_POSIX_ACL */
};
+1 -101
View File
@@ -81,18 +81,6 @@ zpl_dirty_inode(struct inode *ip)
* unhashed and has no links the default policy is to evict it
* immediately.
*
* Prior to 2.6.36 this eviction was accomplished by the vfs calling
* ->delete_inode(). It was ->delete_inode()'s responsibility to
* truncate the inode pages and call clear_inode(). The call to
* clear_inode() synchronously invalidates all the buffers and
* calls ->clear_inode(). It was ->clear_inode()'s responsibility
* to cleanup and filesystem specific data before freeing the inode.
*
* This elaborate mechanism was replaced by ->evict_inode() which
* does the job of both ->delete_inode() and ->clear_inode(). It
* will be called exactly once, and when it returns the inode must
* be in a state where it can simply be freed.i
*
* The ->evict_inode() callback must minimally truncate the inode pages,
* and call clear_inode(). For 2.6.35 and later kernels this will
* simply update the inode state, with the sync occurring before the
@@ -102,7 +90,6 @@ zpl_dirty_inode(struct inode *ip)
* any remaining inode specific data via zfs_inactive().
* remaining filesystem specific data.
*/
#ifdef HAVE_EVICT_INODE
static void
zpl_evict_inode(struct inode *ip)
{
@@ -115,32 +102,6 @@ zpl_evict_inode(struct inode *ip)
spl_fstrans_unmark(cookie);
}
#else
static void
zpl_drop_inode(struct inode *ip)
{
generic_delete_inode(ip);
}
static void
zpl_clear_inode(struct inode *ip)
{
fstrans_cookie_t cookie;
cookie = spl_fstrans_mark();
zfs_inactive(ip);
spl_fstrans_unmark(cookie);
}
static void
zpl_inode_delete(struct inode *ip)
{
truncate_setsize(ip, 0);
clear_inode(ip);
}
#endif /* HAVE_EVICT_INODE */
static void
zpl_put_super(struct super_block *sb)
{
@@ -241,19 +202,11 @@ __zpl_show_options(struct seq_file *seq, zfsvfs_t *zfsvfs)
return (0);
}
#ifdef HAVE_SHOW_OPTIONS_WITH_DENTRY
static int
zpl_show_options(struct seq_file *seq, struct dentry *root)
{
return (__zpl_show_options(seq, root->d_sb->s_fs_info));
}
#else
static int
zpl_show_options(struct seq_file *seq, struct vfsmount *vfsp)
{
return (__zpl_show_options(seq, vfsp->mnt_sb->s_fs_info));
}
#endif /* HAVE_SHOW_OPTIONS_WITH_DENTRY */
static int
zpl_fill_super(struct super_block *sb, void *data, int silent)
@@ -301,7 +254,7 @@ zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mnt_t *zm)
* this can prevent the pool sync and cause a deadlock.
*/
dsl_pool_rele(dmu_objset_pool(os), FTAG);
s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os);
s = sget(fs_type, zpl_test_super, set_anon_super, flags, os);
dsl_dataset_rele(dmu_objset_ds(os), FTAG);
if (IS_ERR(s))
@@ -322,7 +275,6 @@ zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mnt_t *zm)
return (s);
}
#ifdef HAVE_FST_MOUNT
static struct dentry *
zpl_mount(struct file_system_type *fs_type, int flags,
const char *osname, void *data)
@@ -335,32 +287,12 @@ zpl_mount(struct file_system_type *fs_type, int flags,
return (dget(sb->s_root));
}
#else
static int
zpl_get_sb(struct file_system_type *fs_type, int flags,
const char *osname, void *data, struct vfsmount *mnt)
{
zfs_mnt_t zm = { .mnt_osname = osname, .mnt_data = data };
struct super_block *sb = zpl_mount_impl(fs_type, flags, &zm);
if (IS_ERR(sb))
return (PTR_ERR(sb));
(void) simple_set_mnt(mnt, sb);
return (0);
}
#endif /* HAVE_FST_MOUNT */
static void
zpl_kill_sb(struct super_block *sb)
{
zfs_preumount(sb);
kill_anon_super(sb);
#ifdef HAVE_S_INSTANCES_LIST_HEAD
sb->s_instances.next = &(zpl_fs_type.fs_supers);
#endif /* HAVE_S_INSTANCES_LIST_HEAD */
}
void
@@ -372,55 +304,23 @@ zpl_prune_sb(int64_t nr_to_scan, void *arg)
(void) -zfs_prune(sb, nr_to_scan, &objects);
}
#ifdef HAVE_NR_CACHED_OBJECTS
static int
zpl_nr_cached_objects(struct super_block *sb)
{
return (0);
}
#endif /* HAVE_NR_CACHED_OBJECTS */
#ifdef HAVE_FREE_CACHED_OBJECTS
static void
zpl_free_cached_objects(struct super_block *sb, int nr_to_scan)
{
/* noop */
}
#endif /* HAVE_FREE_CACHED_OBJECTS */
const struct super_operations zpl_super_operations = {
.alloc_inode = zpl_inode_alloc,
.destroy_inode = zpl_inode_destroy,
.dirty_inode = zpl_dirty_inode,
.write_inode = NULL,
#ifdef HAVE_EVICT_INODE
.evict_inode = zpl_evict_inode,
#else
.drop_inode = zpl_drop_inode,
.clear_inode = zpl_clear_inode,
.delete_inode = zpl_inode_delete,
#endif /* HAVE_EVICT_INODE */
.put_super = zpl_put_super,
.sync_fs = zpl_sync_fs,
.statfs = zpl_statfs,
.remount_fs = zpl_remount_fs,
.show_options = zpl_show_options,
.show_stats = NULL,
#ifdef HAVE_NR_CACHED_OBJECTS
.nr_cached_objects = zpl_nr_cached_objects,
#endif /* HAVE_NR_CACHED_OBJECTS */
#ifdef HAVE_FREE_CACHED_OBJECTS
.free_cached_objects = zpl_free_cached_objects,
#endif /* HAVE_FREE_CACHED_OBJECTS */
};
struct file_system_type zpl_fs_type = {
.owner = THIS_MODULE,
.name = ZFS_DRIVER,
#ifdef HAVE_FST_MOUNT
.mount = zpl_mount,
#else
.get_sb = zpl_get_sb,
#endif /* HAVE_FST_MOUNT */
.kill_sb = zpl_kill_sb,
};
+5 -84
View File
@@ -113,9 +113,6 @@ zpl_xattr_permission(xattr_filldir_t *xf, const char *name, int name_len)
#elif defined(HAVE_XATTR_LIST_HANDLER)
if (!handler->list(handler, d, NULL, 0, name, name_len))
return (0);
#elif defined(HAVE_XATTR_LIST_INODE)
if (!handler->list(d->d_inode, NULL, 0, name, name_len))
return (0);
#endif
}
@@ -870,9 +867,8 @@ __zpl_xattr_security_set(struct inode *ip, const char *name,
}
ZPL_XATTR_SET_WRAPPER(zpl_xattr_security_set);
#ifdef HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY
static int
__zpl_xattr_security_init(struct inode *ip, const struct xattr *xattrs,
zpl_xattr_security_init_impl(struct inode *ip, const struct xattr *xattrs,
void *fs_info)
{
const struct xattr *xattr;
@@ -894,37 +890,9 @@ zpl_xattr_security_init(struct inode *ip, struct inode *dip,
const struct qstr *qstr)
{
return security_inode_init_security(ip, dip, qstr,
&__zpl_xattr_security_init, NULL);
&zpl_xattr_security_init_impl, NULL);
}
#else
int
zpl_xattr_security_init(struct inode *ip, struct inode *dip,
const struct qstr *qstr)
{
int error;
size_t len;
void *value;
char *name;
error = zpl_security_inode_init_security(ip, dip, qstr,
&name, &value, &len);
if (error) {
if (error == -EOPNOTSUPP)
return (0);
return (error);
}
error = __zpl_xattr_security_set(ip, name, value, len, 0);
kfree(name);
kfree(value);
return (error);
}
#endif /* HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY */
/*
* Security xattr namespace handlers.
*/
@@ -958,7 +926,7 @@ zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type)
case ACL_TYPE_ACCESS:
name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
zpl_equivmode_t mode = ip->i_mode;
umode_t mode = ip->i_mode;
error = posix_acl_equiv_mode(acl, &mode);
if (error < 0) {
return (error);
@@ -1073,53 +1041,6 @@ zpl_get_acl(struct inode *ip, int type)
return (acl);
}
#if !defined(HAVE_GET_ACL)
static int
__zpl_check_acl(struct inode *ip, int mask)
{
struct posix_acl *acl;
int error;
acl = zpl_get_acl(ip, ACL_TYPE_ACCESS);
if (IS_ERR(acl))
return (PTR_ERR(acl));
if (acl) {
error = posix_acl_permission(ip, acl, mask);
zpl_posix_acl_release(acl);
return (error);
}
return (-EAGAIN);
}
#if defined(HAVE_CHECK_ACL_WITH_FLAGS)
int
zpl_check_acl(struct inode *ip, int mask, unsigned int flags)
{
return (__zpl_check_acl(ip, mask));
}
#elif defined(HAVE_CHECK_ACL)
int
zpl_check_acl(struct inode *ip, int mask)
{
return (__zpl_check_acl(ip, mask));
}
#elif defined(HAVE_PERMISSION_WITH_NAMEIDATA)
int
zpl_permission(struct inode *ip, int mask, struct nameidata *nd)
{
return (generic_permission(ip, mask, __zpl_check_acl));
}
#elif defined(HAVE_PERMISSION)
int
zpl_permission(struct inode *ip, int mask)
{
return (generic_permission(ip, mask, __zpl_check_acl));
}
#endif /* HAVE_CHECK_ACL | HAVE_PERMISSION */
#endif /* !HAVE_GET_ACL */
int
zpl_init_acl(struct inode *ip, struct inode *dir)
{
@@ -1295,7 +1216,7 @@ __zpl_xattr_acl_set_access(struct inode *ip, const char *name,
if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL)
return (-EOPNOTSUPP);
if (!zpl_inode_owner_or_capable(ip))
if (!inode_owner_or_capable(ip))
return (-EPERM);
if (value) {
@@ -1335,7 +1256,7 @@ __zpl_xattr_acl_set_default(struct inode *ip, const char *name,
if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL)
return (-EOPNOTSUPP);
if (!zpl_inode_owner_or_capable(ip))
if (!inode_owner_or_capable(ip))
return (-EPERM);
if (value) {
+1 -42
View File
@@ -392,9 +392,7 @@ zvol_request(struct request_queue *q, struct bio *bio)
out:
spl_fstrans_unmark(cookie);
#ifdef HAVE_MAKE_REQUEST_FN_RET_INT
return (0);
#elif defined(HAVE_MAKE_REQUEST_FN_RET_QC)
#if defined(HAVE_MAKE_REQUEST_FN_RET_QC)
return (BLK_QC_T_NONE);
#endif
}
@@ -480,11 +478,7 @@ out_mutex:
return (SET_ERROR(error));
}
#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
static void
#else
static int
#endif
zvol_release(struct gendisk *disk, fmode_t mode)
{
zvol_state_t *zv;
@@ -527,10 +521,6 @@ zvol_release(struct gendisk *disk, fmode_t mode)
if (drop_suspend)
rw_exit(&zv->zv_suspend_lock);
#ifndef HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
return (0);
#endif
}
static int
@@ -579,10 +569,6 @@ zvol_compat_ioctl(struct block_device *bdev, fmode_t mode,
#define zvol_compat_ioctl NULL
#endif
/*
* Linux 2.6.38 preferred interface.
*/
#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
static unsigned int
zvol_check_events(struct gendisk *disk, unsigned int clearing)
{
@@ -602,27 +588,6 @@ zvol_check_events(struct gendisk *disk, unsigned int clearing)
return (mask);
}
#else
static int
zvol_media_changed(struct gendisk *disk)
{
int changed = 0;
rw_enter(&zvol_state_lock, RW_READER);
zvol_state_t *zv = disk->private_data;
if (zv != NULL) {
mutex_enter(&zv->zv_state_lock);
changed = zv->zv_changed;
zv->zv_changed = 0;
mutex_exit(&zv->zv_state_lock);
}
rw_exit(&zvol_state_lock);
return (changed);
}
#endif
static int
zvol_revalidate_disk(struct gendisk *disk)
@@ -741,11 +706,7 @@ static struct block_device_operations zvol_ops = {
.release = zvol_release,
.ioctl = zvol_ioctl,
.compat_ioctl = zvol_compat_ioctl,
#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
.check_events = zvol_check_events,
#else
.media_changed = zvol_media_changed,
#endif
.revalidate_disk = zvol_revalidate_disk,
.getgeo = zvol_getgeo,
.owner = THIS_MODULE,
@@ -803,9 +764,7 @@ zvol_alloc(dev_t dev, const char *name)
rw_init(&zv->zv_suspend_lock, NULL, RW_DEFAULT, NULL);
zv->zv_zso->zvo_disk->major = zvol_major;
#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
zv->zv_zso->zvo_disk->events = DISK_EVENT_MEDIA_CHANGE;
#endif
if (volmode == ZFS_VOLMODE_DEV) {
/*