Compare commits

...

17 Commits

Author SHA1 Message Date
Brian Behlendorf ae18e03625 Tag zfs-0.6.3-1.3
META file updated and .nogitrelease file added to ensure
packages built from this tag use the release in META.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2015-03-18 13:43:02 -07:00
Brian Behlendorf fa2a39dbab Update code to use misc_register()/misc_deregister()
When ZPIOS was originally written it was designed to use the
device_create() and device_destroy() functions.  Unfortunately,
these functions changed considerably over the years making them
difficult to rely on.

As it turns out a better choice would have been to use the
misc_register()/misc_deregister() functions.  This interface
for registering character devices has remained stable, is simple,
and provides everything we need.

Therefore the code has been reworked to use this interface.  The
higher level ZFS code has always depended on these same interfaces
so this is also as a step towards minimizing our kernel dependencies.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2757
2015-03-18 10:44:37 -07:00
Bill McGonigle e5adebbb0f Linux 4.0 compat: bdi_setup_and_register() __must_check
Explicitly disable the unused by variable warnings by setting
__attribute__((unused)) for bdi_setup_and_register().  This is
required because the function is defined with the __must_check
attribute.

Signed-off-by: Bill McGonigle <bill-github.com-public1@bfccomputing.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3141
2015-03-18 09:11:28 -07:00
Brian Behlendorf 4374e65bd9 Linux 4.0 compat: bdi_setup_and_register()
The 'capabilities' argument which was passed to bdi_setup_and_register()
has been removed.  File systems should no longer pass BDI_CAP_MAP_COPY.
For our purposes this means there are now three different interfaces
which must be handled.  A zpl_bdi_setup_and_register() wrapper function
has been introduced to provide a single interface to the ZPL code.

* 2.6.32 - 2.6.33, bdi_setup_and_register() is not exported.
* 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments.
* 4.0 - x.y, bdi_setup_and_register() takes 2 arguments.

I've also taken this opportunity to remove HAVE_BDI because kernels
older then 2.6.32 are no longer supported.  All kernels newer than
this will have one of the above interfaces.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Closes #3128
2015-03-16 10:39:50 -07:00
Jörg Thalheim 157f14abf8 Linux 3.19 compat: file_inode was added
struct access f->f_dentry->d_inode was replaced by accessor function
file_inode(f)

Signed-off-by: Joerg Thalheim <joerg@higgsboson.tk>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3084
2015-03-16 10:39:45 -07:00
Tim Chase 1817cb6dc6 Linux 3.12 compat: split shrinker has s_shrink
The split count/scan shrinker callbacks introduced in 3.12 broke the
test for HAVE_SHRINK, effectively disabling the per-superblock shrinkers.

This patch re-enables the per-superblock shrinkers when the split shrinker
callbacks have been detected.

Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2975
2015-03-16 10:38:47 -07:00
Brian Behlendorf 7b13354d55 Tag zfs-0.6.3-1.2
META file updated and .nogitrelease file added to ensure
packages built from this tag use the release in META.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2014-12-23 10:39:27 -08:00
Andy Bakun c3db49aedd Fix typo in %post scriptlet lines
Missing space made the %post directive be part of the package
%description and not have a %post scriptlet defined.

Signed-off-by: Andy Bakun <github@thwartedefforts.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2961
2014-12-23 10:39:27 -08:00
Tim Chase 73fd1f4656 Don't perform ACL-to-mode translation on empty ACL
In zfs_acl_chown_setattr(), the zfs_mode_comput() function is used to
create a traditional mode value based on an ACL.  If no ACL exists, this
processing shouldn't be done.  Problems caused by this were most evident
on version 4 filesystems which not only don't have system attributes,
and also frequently have empty ACLs. On such filesystems, performing a
chown() operation could have the effect of dirtying the mode bits in
memory but not on the file system as follows:

	# create a file with typical mode of 664
	echo test > test
	chown anyuser test
	ls -l test

and the mode will show up as all zeroes.  Unmounting/mounting and/or
exporting/importing the filesystem will reveal the proper mode again.

Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1264
2014-12-22 16:31:51 -08:00
Tim Chase a85804ecb5 Undirty freed spill blocks.
If a spill block's dbuf hasn't yet been written when a spill block is
freed, the unwritten version will still be written.  This patch handles
the case in which a spill block's dbuf is freed and undirties it to
prevent it from being written.

The most common case in which this could happen is when xattr=sa is being
used and a long xattr is immediately replaced by a short xattr as in:

	setfattr -n user.test -v very_very_very..._long_value  <file>
	setfattr -n user.test -v short_value  <file>

The first value must be sufficiently long that a spill block is generated
and the second value must be short enough to not require a spill block.
In practice, this would typically happen due to internal xattr operations
as a result of setting acltype=posixacl.

Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2663
Closes #2700
Closes #2701
Closes #2717
Closes #2863
Closes #2884
2014-12-22 16:31:32 -08:00
Alex Zhuravlev 5b2926547f Export symbols for ZIL interface
These symbols are needed by consumers (i.e. Lustre) who wish to
integrate with the ZIL.  In addition the zil_rollback_destroy()
prototype was removed because the implementation of this function
was removed long ago.

Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2892
2014-12-22 16:14:30 -08:00
Ned Bass 107077a193 Remove checks for mandatory locks
The Linux VFS handles mandatory locks generically so we shouldn't
need to check for conflicting locks in zfs_read(), zfs_write(), or
zfs_freesp().  Linux 3.18 removed the lock_may_read() and
lock_may_write() interfaces which we were relying on for this
purpose.  Rather than emulating those interfaces we remove the
redundant checks.

Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2804
2014-12-22 16:13:34 -08:00
Tim Chase c69e727898 Linux 3.12 compat: shrinker semantics
The new shrinker API as of Linux 3.12 modifies "struct shrinker" by
replacing the @shrink callback with the pair of @count_objects and
@scan_objects.  It also requires the return value of @count_objects to
return the number of objects actually freed whereas the previous @shrink
callback returned the number of remaining freeable objects.

This patch adds support for the new @scan_objects return value semantics.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes #2837
2014-12-22 16:13:04 -08:00
Brian Behlendorf 92428b6d56 Tag zfs-0.6.3-1.1
META file updated and .nogitrelease file added to ensure
packages built from this tag use the release in META.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2014-10-09 14:07:58 -07:00
Brian Behlendorf 908a0c2822 Fix zil_commit() NULL dereference
Update the current code to ensure inodes are never dirtied if they are
part of a read-only file system or snapshot.  If they do somehow get
dirtied an attempt will make made to write them to disk.  In the case
of snapshots, which don't have a ZIL, this will result in a NULL
dereference in zil_commit().

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2405
2014-10-09 13:56:09 -07:00
Tom Prince 46bf86a963 Point dkms build at installed source tree, rather than build directory.
Signed-off-by: Tom Prince <tom.prince@clusterhq.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2776
2014-10-09 13:56:04 -07:00
Tom Prince 83a3269f59 Install header during post-build rather than post-install.
New versions of dkms clean up the build directory after installing.

It appears that this was always intended, but had rm -rf "/path/to/build/*"
(note the quotes), which prevented it from working.

Also, the build step is already installing stuff into the directory where
these files go, so installing our stuff there as part of build rather than
install makes sense.

Signed-off-by: Tom Prince <tom.prince@clusterhq.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2776
2014-10-09 12:33:47 -07:00
25 changed files with 211 additions and 185 deletions

0
.nogitrelease Normal file
View File

2
META
View File

@ -2,7 +2,7 @@ Meta: 1
Name: zfs
Branch: 1.0
Version: 0.6.3
Release: 1
Release: 1.3
Release-Tags: relext
License: CDDL
Author: Sun Microsystems/Oracle, Lawrence Livermore National Laboratory

View File

@ -1,22 +1,38 @@
dnl #
dnl # 2.6.34 API change
dnl # The bdi_setup_and_register() helper function is avaliable and
dnl # exported by the kernel. This is a trivial helper function but
dnl # using it significantly simplifies the code surrounding setting
dnl # up and tearing down the bdi structure.
dnl # 2.6.32 - 2.6.33, bdi_setup_and_register() is not exported.
dnl # 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments.
dnl # 4.0 - x.y, bdi_setup_and_register() takes 2 arguments.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER],
[AC_MSG_CHECKING([whether bdi_setup_and_register() is available])
AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER], [
AC_MSG_CHECKING([whether bdi_setup_and_register() wants 2 args])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/backing-dev.h>
], [
int r = bdi_setup_and_register(NULL, NULL, 0);
r = *(&r);
struct backing_dev_info bdi;
char *name = "bdi";
int error __attribute__((unused)) =
bdi_setup_and_register(&bdi, name);
], [bdi_setup_and_register], [mm/backing-dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BDI_SETUP_AND_REGISTER, 1,
[bdi_setup_and_register() is available])
AC_DEFINE(HAVE_2ARGS_BDI_SETUP_AND_REGISTER, 1,
[bdi_setup_and_register() wants 2 args])
], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether bdi_setup_and_register() wants 3 args])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/backing-dev.h>
], [
struct backing_dev_info bdi;
char *name = "bdi";
unsigned int cap = BDI_CAP_MAP_COPY;
int error __attribute__((unused)) =
bdi_setup_and_register(&bdi, name, cap);
], [bdi_setup_and_register], [mm/backing-dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1,
[bdi_setup_and_register() wants 3 args])
], [
AC_MSG_RESULT(no)
])
])
])

View File

@ -1,21 +0,0 @@
dnl #
dnl # 2.6.32 API change
dnl # Private backing_device_info interfaces available
dnl #
AC_DEFUN([ZFS_AC_KERNEL_BDI], [
AC_MSG_CHECKING([whether super_block has s_bdi])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
static const struct super_block
sb __attribute__ ((unused)) = {
.s_bdi = NULL,
};
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BDI, 1, [struct super_block has s_bdi])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -0,0 +1,19 @@
dnl #
dnl # 3.19 API change
dnl # struct access f->f_dentry->d_inode was replaced by accessor function
dnl # file_inode(f)
dnl #
AC_DEFUN([ZFS_AC_KERNEL_FILE_INODE], [
AC_MSG_CHECKING([whether file_inode() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct file *f = NULL;
file_inode(f);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_INODE, 1, [file_inode() is available])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -60,6 +60,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
ZFS_AC_KERNEL_CURRENT_UMASK
ZFS_AC_KERNEL_SHOW_OPTIONS
ZFS_AC_KERNEL_FILE_INODE
ZFS_AC_KERNEL_FSYNC
ZFS_AC_KERNEL_EVICT_INODE
ZFS_AC_KERNEL_DIRTY_INODE_WITH_FLAGS
@ -88,7 +89,6 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_SHRINK
ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD
ZFS_AC_KERNEL_S_D_OP
ZFS_AC_KERNEL_BDI
ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER
ZFS_AC_KERNEL_SET_NLINK
ZFS_AC_KERNEL_ELEVATOR_CHANGE

View File

@ -21,6 +21,7 @@
/*
* Copyright (C) 2011 Lawrence Livermore National Security, LLC.
* Copyright (C) 2015 Jörg Thalheim.
*/
#ifndef _ZFS_VFS_H
@ -62,25 +63,35 @@ truncate_setsize(struct inode *ip, loff_t new)
}
#endif /* HAVE_TRUNCATE_SETSIZE */
#if defined(HAVE_BDI) && !defined(HAVE_BDI_SETUP_AND_REGISTER)
/*
* 2.6.34 API change,
* Add bdi_setup_and_register() function if not yet provided by kernel.
* It is used to quickly initialize and register a BDI for the filesystem.
* 2.6.32 - 2.6.33, bdi_setup_and_register() is not available.
* 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments.
* 4.0 - x.y, bdi_setup_and_register() takes 2 arguments.
*/
#if defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER)
static inline int
zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name)
{
return (bdi_setup_and_register(bdi, name));
}
#elif defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER)
static inline int
zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name)
{
return (bdi_setup_and_register(bdi, name, BDI_CAP_MAP_COPY));
}
#else
extern atomic_long_t zfs_bdi_seq;
static inline int
bdi_setup_and_register(
struct backing_dev_info *bdi,
char *name,
unsigned int cap)
zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name)
{
char tmp[32];
int error;
bdi->name = name;
bdi->capabilities = cap;
bdi->capabilities = BDI_CAP_MAP_COPY;
error = bdi_init(bdi);
if (error)
return (error);
@ -95,7 +106,7 @@ bdi_setup_and_register(
return (error);
}
#endif /* HAVE_BDI && !HAVE_BDI_SETUP_AND_REGISTER */
#endif
/*
* 2.6.38 API change,
@ -326,4 +337,16 @@ current_umask(void)
#define zpl_inode_owner_or_capable(ip) is_owner_or_cap(ip)
#endif /* HAVE_INODE_OWNER_OR_CAPABLE */
/*
* 3.19 API change
* struct access f->f_dentry->d_inode was replaced by accessor function
* file_inode(f)
*/
#ifndef HAVE_FILE_INODE
static inline struct inode *file_inode(const struct file *f)
{
return (f->f_dentry->d_inode);
}
#endif /* HAVE_FILE_INODE */
#endif /* _ZFS_VFS_H */

View File

@ -337,6 +337,7 @@ extern void zfs_znode_dmu_fini(znode_t *);
extern int zfs_inode_alloc(struct super_block *, struct inode **ip);
extern void zfs_inode_destroy(struct inode *);
extern void zfs_inode_update(znode_t *);
extern void zfs_mark_inode_dirty(struct inode *);
extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
znode_t *dzp, znode_t *zp, char *name, vsecattr_t *, zfs_fuid_info_t *,

View File

@ -459,7 +459,6 @@ extern void zil_replay(objset_t *os, void *arg,
extern boolean_t zil_replaying(zilog_t *zilog, dmu_tx_t *tx);
extern void zil_destroy(zilog_t *zilog, boolean_t keep_first);
extern void zil_destroy_sync(zilog_t *zilog, dmu_tx_t *tx);
extern void zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx);
extern itx_t *zil_itx_create(uint64_t txtype, size_t lrsize);
extern void zil_itx_destroy(itx_t *itx);

View File

@ -42,8 +42,6 @@
#include <stdint.h>
#endif
#define ZPIOS_MAJOR 232 /* XXX - Arbitrary */
#define ZPIOS_MINORS 1
#define ZPIOS_NAME "zpios"
#define ZPIOS_DEV "/dev/zpios"

View File

@ -2590,27 +2590,39 @@ arc_evictable_memory(void) {
return (ghost_clean + MAX((int64_t)arc_size - (int64_t)arc_c_min, 0));
}
static int
/*
* If sc->nr_to_scan is zero, the caller is requesting a query of the
* number of objects which can potentially be freed. If it is nonzero,
* the request is to free that many objects.
*
* Linux kernels >= 3.12 have the count_objects and scan_objects callbacks
* in struct shrinker and also require the shrinker to return the number
* of objects freed.
*
* Older kernels require the shrinker to return the number of freeable
* objects following the freeing of nr_to_free.
*/
static spl_shrinker_t
__arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc)
{
uint64_t pages;
int64_t pages;
/* The arc is considered warm once reclaim has occurred */
if (unlikely(arc_warm == B_FALSE))
arc_warm = B_TRUE;
/* Return the potential number of reclaimable pages */
pages = btop(arc_evictable_memory());
pages = btop((int64_t)arc_evictable_memory());
if (sc->nr_to_scan == 0)
return (pages);
/* Not allowed to perform filesystem reclaim */
if (!(sc->gfp_mask & __GFP_FS))
return (-1);
return (SHRINK_STOP);
/* Reclaim in progress */
if (mutex_tryenter(&arc_reclaim_thr_lock) == 0)
return (-1);
return (SHRINK_STOP);
/*
* Evict the requested number of pages by shrinking arc_c the
@ -2619,10 +2631,15 @@ __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc)
*/
if (pages > 0) {
arc_kmem_reap_now(ARC_RECLAIM_AGGR, ptob(sc->nr_to_scan));
#ifdef HAVE_SPLIT_SHRINKER_CALLBACK
pages = MAX(pages - btop(arc_evictable_memory()), 0);
#else
pages = btop(arc_evictable_memory());
#endif
} else {
arc_kmem_reap_now(ARC_RECLAIM_CONS, ptob(sc->nr_to_scan));
pages = -1;
pages = SHRINK_STOP;
}
/*
@ -5602,6 +5619,8 @@ l2arc_stop(void)
}
#if defined(_KERNEL) && defined(HAVE_SPL)
EXPORT_SYMBOL(arc_buf_size);
EXPORT_SYMBOL(arc_write);
EXPORT_SYMBOL(arc_read);
EXPORT_SYMBOL(arc_buf_remove_ref);
EXPORT_SYMBOL(arc_buf_info);

View File

@ -875,15 +875,18 @@ dbuf_free_range(dnode_t *dn, uint64_t start, uint64_t end, dmu_tx_t *tx)
int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT;
uint64_t first_l1 = start >> epbs;
uint64_t last_l1 = end >> epbs;
boolean_t freespill =
(start == DMU_SPILL_BLKID || end == DMU_SPILL_BLKID);
if (end > dn->dn_maxblkid && (end != DMU_SPILL_BLKID)) {
if (end > dn->dn_maxblkid && !freespill) {
end = dn->dn_maxblkid;
last_l1 = end >> epbs;
}
dprintf_dnode(dn, "start=%llu end=%llu\n", start, end);
mutex_enter(&dn->dn_dbufs_mtx);
if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz) {
if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz &&
!freespill) {
/* There can't be any dbufs in this range; no need to search. */
mutex_exit(&dn->dn_dbufs_mtx);
return;
@ -919,7 +922,7 @@ dbuf_free_range(dnode_t *dn, uint64_t start, uint64_t end, dmu_tx_t *tx)
if (db->db_level != 0)
continue;
dprintf_dbuf(db, "found buf %s\n", "");
if (db->db_blkid < start || db->db_blkid > end)
if ((db->db_blkid < start || db->db_blkid > end) && !freespill)
continue;
/* found a level 0 buffer in the range */
@ -2968,4 +2971,5 @@ EXPORT_SYMBOL(dmu_buf_set_user_ie);
EXPORT_SYMBOL(dmu_buf_update_user);
EXPORT_SYMBOL(dmu_buf_get_user);
EXPORT_SYMBOL(dmu_buf_freeable);
EXPORT_SYMBOL(dmu_buf_get_blkptr);
#endif

View File

@ -1162,7 +1162,8 @@ zfs_acl_chown_setattr(znode_t *zp)
ASSERT(MUTEX_HELD(&zp->z_lock));
ASSERT(MUTEX_HELD(&zp->z_acl_lock));
if ((error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE)) == 0)
error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE);
if (error == 0 && aclp->z_acl_count > 0)
zp->z_mode = zfs_mode_compute(zp->z_mode, aclp,
&zp->z_pflags, zp->z_uid, zp->z_gid);

View File

@ -1073,7 +1073,7 @@ zfs_root(zfs_sb_t *zsb, struct inode **ipp)
}
EXPORT_SYMBOL(zfs_root);
#ifdef HAVE_SHRINK
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
int
zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
{
@ -1085,13 +1085,17 @@ zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
};
ZFS_ENTER(zsb);
#ifdef HAVE_SPLIT_SHRINKER_CALLBACK
*objects = (*shrinker->scan_objects)(shrinker, &sc);
#else
*objects = (*shrinker->shrink)(shrinker, &sc);
#endif
ZFS_EXIT(zsb);
return (0);
}
EXPORT_SYMBOL(zfs_sb_prune);
#endif /* HAVE_SHRINK */
#endif /* defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) */
/*
* Teardown the zfs_sb_t.
@ -1199,9 +1203,10 @@ zfs_sb_teardown(zfs_sb_t *zsb, boolean_t unmounting)
}
EXPORT_SYMBOL(zfs_sb_teardown);
#if defined(HAVE_BDI) && !defined(HAVE_BDI_SETUP_AND_REGISTER)
#if !defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \
!defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER)
atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0);
#endif /* HAVE_BDI && !HAVE_BDI_SETUP_AND_REGISTER */
#endif
int
zfs_domount(struct super_block *sb, void *data, int silent)
@ -1228,23 +1233,12 @@ zfs_domount(struct super_block *sb, void *data, int silent)
sb->s_time_gran = 1;
sb->s_blocksize = recordsize;
sb->s_blocksize_bits = ilog2(recordsize);
#ifdef HAVE_BDI
/*
* 2.6.32 API change,
* Added backing_device_info (BDI) per super block interfaces. A BDI
* must be configured when using a non-device backed filesystem for
* proper writeback. This is not required for older pdflush kernels.
*
* NOTE: Linux read-ahead is disabled in favor of zfs read-ahead.
*/
zsb->z_bdi.ra_pages = 0;
sb->s_bdi = &zsb->z_bdi;
error = -bdi_setup_and_register(&zsb->z_bdi, "zfs", BDI_CAP_MAP_COPY);
error = -zpl_bdi_setup_and_register(&zsb->z_bdi, "zfs");
if (error)
goto out;
#endif /* HAVE_BDI */
/* Set callback operations for the file system. */
sb->s_op = &zpl_super_operations;
@ -1337,10 +1331,7 @@ zfs_umount(struct super_block *sb)
VERIFY(zfs_sb_teardown(zsb, B_TRUE) == 0);
os = zsb->z_os;
#ifdef HAVE_BDI
bdi_destroy(sb->s_bdi);
#endif /* HAVE_BDI */
/*
* z_os will be NULL if there was an error in

View File

@ -470,15 +470,6 @@ zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
return (0);
}
/*
* Check for mandatory locks
*/
if (mandatory_lock(ip) &&
!lock_may_read(ip, uio->uio_loffset, uio->uio_resid)) {
ZFS_EXIT(zsb);
return (SET_ERROR(EAGAIN));
}
/*
* If we're in FRSYNC mode, sync out this znode before reading it.
*/
@ -647,15 +638,6 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
return (SET_ERROR(EINVAL));
}
/*
* Check for mandatory locks before calling zfs_range_lock()
* in order to prevent a deadlock with locks set via fcntl().
*/
if (mandatory_lock(ip) && !lock_may_write(ip, woff, n)) {
ZFS_EXIT(zsb);
return (SET_ERROR(EAGAIN));
}
/*
* Pre-fault the pages to ensure slow (eg NFS) pages
* don't hold up txg.
@ -3965,7 +3947,8 @@ zfs_putpage(struct inode *ip, struct page *pp, struct writeback_control *wbc)
* writepages() normally handles the entire commit for
* performance reasons.
*/
zil_commit(zsb->z_log, zp->z_id);
if (zsb->z_log != NULL)
zil_commit(zsb->z_log, zp->z_id);
}
ZFS_EXIT(zsb);

View File

@ -511,6 +511,21 @@ zfs_inode_update(znode_t *zp)
spin_unlock(&ip->i_lock);
}
/*
* Safely mark an inode dirty. Inodes which are part of a read-only
* file system or snapshot may not be dirtied.
*/
void
zfs_mark_inode_dirty(struct inode *ip)
{
zfs_sb_t *zsb = ITOZSB(ip);
if (zfs_is_readonly(zsb) || dmu_objset_is_snapshot(zsb->z_os))
return;
mark_inode_dirty(ip);
}
static uint64_t empty_xattr;
static uint64_t pad[4];
static zfs_acl_phys_t acl_phys;
@ -1456,7 +1471,6 @@ top:
int
zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
{
struct inode *ip = ZTOI(zp);
dmu_tx_t *tx;
zfs_sb_t *zsb = ZTOZSB(zp);
zilog_t *zilog = zsb->z_log;
@ -1478,15 +1492,6 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
return (error);
}
/*
* Check for any locks in the region to be freed.
*/
if (ip->i_flock && mandatory_lock(ip)) {
uint64_t length = (len ? len : zp->z_size - off);
if (!lock_may_write(ip, off, length))
return (SET_ERROR(EAGAIN));
}
if (len == 0) {
error = zfs_trunc(zp, off);
} else {

View File

@ -2237,6 +2237,30 @@ zil_vdev_offline(const char *osname, void *arg)
}
#if defined(_KERNEL) && defined(HAVE_SPL)
EXPORT_SYMBOL(zil_alloc);
EXPORT_SYMBOL(zil_free);
EXPORT_SYMBOL(zil_open);
EXPORT_SYMBOL(zil_close);
EXPORT_SYMBOL(zil_replay);
EXPORT_SYMBOL(zil_replaying);
EXPORT_SYMBOL(zil_destroy);
EXPORT_SYMBOL(zil_destroy_sync);
EXPORT_SYMBOL(zil_itx_create);
EXPORT_SYMBOL(zil_itx_destroy);
EXPORT_SYMBOL(zil_itx_assign);
EXPORT_SYMBOL(zil_commit);
EXPORT_SYMBOL(zil_vdev_offline);
EXPORT_SYMBOL(zil_claim);
EXPORT_SYMBOL(zil_check_log_chain);
EXPORT_SYMBOL(zil_sync);
EXPORT_SYMBOL(zil_clean);
EXPORT_SYMBOL(zil_suspend);
EXPORT_SYMBOL(zil_resume);
EXPORT_SYMBOL(zil_add_block);
EXPORT_SYMBOL(zil_bp_tree_add);
EXPORT_SYMBOL(zil_set_sync);
EXPORT_SYMBOL(zil_set_logbias);
module_param(zil_replay_disable, int, 0644);
MODULE_PARM_DESC(zil_replay_disable, "Disable intent logging replay");

View File

@ -55,7 +55,7 @@ zpl_release(struct inode *ip, struct file *filp)
int error;
if (ITOZ(ip)->z_atime_dirty)
mark_inode_dirty(ip);
zfs_mark_inode_dirty(ip);
crhold(cr);
error = -zfs_close(ip, filp->f_flags, cr);
@ -445,7 +445,8 @@ zpl_writepages(struct address_space *mapping, struct writeback_control *wbc)
if (sync_mode != wbc->sync_mode) {
ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(zp);
zil_commit(zsb->z_log, zp->z_id);
if (zsb->z_log != NULL)
zil_commit(zsb->z_log, zp->z_id);
ZFS_EXIT(zsb);
/*
@ -527,7 +528,7 @@ zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
static int
zpl_ioctl_getflags(struct file *filp, void __user *arg)
{
struct inode *ip = filp->f_dentry->d_inode;
struct inode *ip = file_inode(filp);
unsigned int ioctl_flags = 0;
uint64_t zfs_flags = ITOZ(ip)->z_pflags;
int error;
@ -563,7 +564,7 @@ zpl_ioctl_getflags(struct file *filp, void __user *arg)
static int
zpl_ioctl_setflags(struct file *filp, void __user *arg)
{
struct inode *ip = filp->f_dentry->d_inode;
struct inode *ip = file_inode(filp);
uint64_t zfs_flags = ITOZ(ip)->z_pflags;
unsigned int ioctl_flags;
cred_t *cr = CRED();

View File

@ -268,7 +268,7 @@ zpl_kill_sb(struct super_block *sb)
#endif /* HAVE_S_INSTANCES_LIST_HEAD */
}
#ifdef HAVE_SHRINK
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
/*
* Linux 3.1 - 3.x API
*

View File

@ -751,7 +751,7 @@ zpl_set_acl(struct inode *ip, int type, struct posix_acl *acl)
if (ip->i_mode != mode) {
ip->i_mode = mode;
ip->i_ctime = current_fs_time(sb);
mark_inode_dirty(ip);
zfs_mark_inode_dirty(ip);
}
if (error == 0)
@ -909,7 +909,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
if (!acl) {
ip->i_mode &= ~current_umask();
ip->i_ctime = current_fs_time(ITOZSB(ip)->z_sb);
mark_inode_dirty(ip);
zfs_mark_inode_dirty(ip);
return (0);
}
}
@ -927,7 +927,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
error = __posix_acl_create(&acl, GFP_KERNEL, &mode);
if (error >= 0) {
ip->i_mode = mode;
mark_inode_dirty(ip);
zfs_mark_inode_dirty(ip);
if (error > 0)
error = zpl_set_acl(ip, ACL_TYPE_ACCESS, acl);
}

View File

@ -35,12 +35,10 @@
#include <sys/dmu.h>
#include <sys/txg.h>
#include <sys/dsl_destroy.h>
#include <linux/cdev.h>
#include <linux/miscdevice.h>
#include "zpios-internal.h"
static spl_class *zpios_class;
static spl_device *zpios_device;
static char *zpios_tag = "zpios_tag";
static int
@ -928,12 +926,8 @@ cleanup:
static int
zpios_open(struct inode *inode, struct file *file)
{
unsigned int minor = iminor(inode);
zpios_info_t *info;
if (minor >= ZPIOS_MINORS)
return (-ENXIO);
info = (zpios_info_t *)kmem_alloc(sizeof (*info), KM_SLEEP);
if (info == NULL)
return (-ENOMEM);
@ -956,12 +950,8 @@ zpios_open(struct inode *inode, struct file *file)
static int
zpios_release(struct inode *inode, struct file *file)
{
unsigned int minor = iminor(inode);
zpios_info_t *info = (zpios_info_t *)file->private_data;
if (minor >= ZPIOS_MINORS)
return (-ENXIO);
ASSERT(info);
ASSERT(info->info_buffer);
@ -1143,16 +1133,12 @@ out_cmd:
static long
zpios_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
int rc = 0;
/* Ignore tty ioctls */
if ((cmd & 0xffffff00) == ((int)'T') << 8)
return (-ENOTTY);
if (minor >= ZPIOS_MINORS)
return (-ENXIO);
switch (cmd) {
case ZPIOS_CFG:
rc = zpios_ioctl_cfg(file, arg);
@ -1187,13 +1173,9 @@ static ssize_t
zpios_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
zpios_info_t *info = (zpios_info_t *)file->private_data;
int rc = 0;
if (minor >= ZPIOS_MINORS)
return (-ENXIO);
ASSERT(info);
ASSERT(info->info_buffer);
@ -1224,13 +1206,9 @@ out:
static ssize_t
zpios_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
zpios_info_t *info = (zpios_info_t *)file->private_data;
int rc = 0;
if (minor >= ZPIOS_MINORS)
return (-ENXIO);
ASSERT(info);
ASSERT(info->info_buffer);
@ -1258,13 +1236,9 @@ out:
static loff_t zpios_seek(struct file *file, loff_t offset, int origin)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
zpios_info_t *info = (zpios_info_t *)file->private_data;
int rc = -EINVAL;
if (minor >= ZPIOS_MINORS)
return (-ENXIO);
ASSERT(info);
ASSERT(info->info_buffer);
@ -1292,7 +1266,6 @@ static loff_t zpios_seek(struct file *file, loff_t offset, int origin)
return (rc);
}
static struct cdev zpios_cdev;
static struct file_operations zpios_fops = {
.owner = THIS_MODULE,
.open = zpios_open,
@ -1306,55 +1279,45 @@ static struct file_operations zpios_fops = {
.llseek = zpios_seek,
};
static struct miscdevice zpios_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = ZPIOS_NAME,
.fops = &zpios_fops,
};
#ifdef DEBUG
#define ZFS_DEBUG_STR " (DEBUG mode)"
#else
#define ZFS_DEBUG_STR ""
#endif
static int
zpios_init(void)
{
dev_t dev;
int rc;
int error;
dev = MKDEV(ZPIOS_MAJOR, 0);
if ((rc = register_chrdev_region(dev, ZPIOS_MINORS, ZPIOS_NAME)))
goto error;
/* Support for registering a character driver */
cdev_init(&zpios_cdev, &zpios_fops);
zpios_cdev.owner = THIS_MODULE;
kobject_set_name(&zpios_cdev.kobj, ZPIOS_NAME);
if ((rc = cdev_add(&zpios_cdev, dev, ZPIOS_MINORS))) {
printk(KERN_ERR "ZPIOS: Error adding cdev, %d\n", rc);
kobject_put(&zpios_cdev.kobj);
unregister_chrdev_region(dev, ZPIOS_MINORS);
goto error;
error = misc_register(&zpios_misc);
if (error) {
printk(KERN_INFO "ZPIOS: misc_register() failed %d\n", error);
} else {
printk(KERN_INFO "ZPIOS: Loaded module v%s-%s%s\n",
ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR);
}
/* Support for udev make driver info available in sysfs */
zpios_class = spl_class_create(THIS_MODULE, ZPIOS_NAME);
if (IS_ERR(zpios_class)) {
rc = PTR_ERR(zpios_class);
printk(KERN_ERR "ZPIOS: Error creating zpios class, %d\n", rc);
cdev_del(&zpios_cdev);
unregister_chrdev_region(dev, ZPIOS_MINORS);
goto error;
}
zpios_device = spl_device_create(zpios_class, NULL,
dev, NULL, ZPIOS_NAME);
return (0);
error:
printk(KERN_ERR "ZPIOS: Error registering zpios device, %d\n", rc);
return (rc);
return (error);
}
static int
zpios_fini(void)
{
dev_t dev = MKDEV(ZPIOS_MAJOR, 0);
int error;
spl_device_destroy(zpios_class, zpios_device, dev);
spl_class_destroy(zpios_class);
cdev_del(&zpios_cdev);
unregister_chrdev_region(dev, ZPIOS_MINORS);
error = misc_deregister(&zpios_misc);
if (error)
printk(KERN_INFO "ZPIOS: misc_deregister() failed %d\n", error);
printk(KERN_INFO "ZPIOS: Unloaded module v%s-%s%s\n",
ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR);
return (0);
}

View File

@ -106,7 +106,7 @@ Group: System Environment/Kernel
This package contains the zpool library, which provides support
for managing zpools
%post-n libzpool2 -p /sbin/ldconfig
%post -n libzpool2 -p /sbin/ldconfig
%postun -n libzpool2 -p /sbin/ldconfig
%package -n libnvpair1
@ -119,7 +119,7 @@ pairs. This functionality is used to portably transport data across
process boundaries, between kernel and user space, and can be used
to write self describing data structures on disk.
%post-n libnvpair1 -p /sbin/ldconfig
%post -n libnvpair1 -p /sbin/ldconfig
%postun -n libnvpair1 -p /sbin/ldconfig
%package -n libuutil1
@ -137,7 +137,7 @@ This library provides a variety of compatibility functions for ZFS on Linux:
partitioning.
* libshare: NFS, SMB, and iSCSI service integration for ZFS.
%post-n libuutil1 -p /sbin/ldconfig
%post -n libuutil1 -p /sbin/ldconfig
%postun -n libuutil1 -p /sbin/ldconfig
%package -n libzfs2
@ -147,7 +147,7 @@ Group: System Environment/Kernel
%description -n libzfs2
This package provides support for managing ZFS filesystems
%post-n libzfs2 -p /sbin/ldconfig
%post -n libzfs2 -p /sbin/ldconfig
%postun -n libzfs2 -p /sbin/ldconfig
%package -n libzfs2-devel

View File

@ -1,6 +1,6 @@
SUBDIRS = zpool-config zpios-test zpios-profile
EXTRA_DIST = dkms.mkconf dkms.postinst kmodtool zfs2zol-patch.sed cstyle.pl
EXTRA_DIST = dkms.mkconf dkms.postbuild kmodtool zfs2zol-patch.sed cstyle.pl
pkgdatadir = $(datadir)/@PACKAGE@
dist_pkgdata_SCRIPTS = \

View File

@ -27,7 +27,7 @@ PRE_BUILD="configure
--with-config=kernel
--with-linux=\${kernel_source_dir}
--with-linux-obj=\${kernel_source_dir}
--with-spl=\${dkms_tree}/spl/\${PACKAGE_VERSION}/build
--with-spl=\${source_tree}/spl-\${PACKAGE_VERSION}
--with-spl-obj=\${dkms_tree}/spl/\${PACKAGE_VERSION}/\${kernelver}/\${arch}
--with-spl-timeout=300
\$(
@ -47,7 +47,7 @@ PRE_BUILD="configure
}
)
"
POST_INSTALL="scripts/dkms.postinst
POST_BUILD="scripts/dkms.postbuild
-n \${PACKAGE_NAME}
-v \${PACKAGE_VERSION}
-a \${arch}