Skip to contentSkip to conversation

test osd on zfs

DISCUSSION Sage Weil 8 participants 20 messages Apr 17, 2013 – Apr 19, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Sage Weil

author
#1 lore raw

Hey,

Can you test with the wip-debug-xattr branch? Set debug filestore = 30 and it will dump the xattr values to the log on set and get, so we can see what is going on.

Also/alternatively, strace with -f -v -x, which will (I think) include the full value of the get/setxattr args..

Thanks!
sage

Quoted 34 lines · Aleksey Leonov

Hi all,

I create test VM for try run ceph osd on zfs. mkcephfs run ok. Osd down 2 minutes after start.

ceph.conf
[global]
max open files = 131072
log file = /var/log/ceph/$name.log
pid file = /var/run/ceph/$name.pid
[mon]
mon data = /ceph/mon/$name
[mon.alpha]
host = ct1
mon addr = 10.10.10.2:6789
[mds]
[mds.alpha]
host = ct1
[osd]
debug filestore = 20
filestore xattr use omap = true
osd data = /ceph/osd/$name
osd journal = /ceph/osd/$name/journal
osd journal size = 2000 ; journal size, in megabytes journal dio = false
journal aio = false

[osd.0]
host = ct1

#2 lore raw

I looked into this problem earlier. The problem is that zfs does not return ERANGE when the size of value buffer passed to getxattr is too small. zfs returns with truncated xattr value.

Regards,
Henry

2013/4/17 Sage Weil <[email protected]>:

Quoted 53 lines

Hey,

Can you test with the wip-debug-xattr branch? Set debug filestore = 30 and it will dump the xattr values to the log on set and get, so we can see what is going on.

Also/alternatively, strace with -f -v -x, which will (I think) include the full value of the get/setxattr args..

Thanks!
sage

Quoted 27 lines · Aleksey Leonov

Hi all,

I create test VM for try run ceph osd on zfs. mkcephfs run ok. Osd down 2 minutes after start.

ceph.conf
[global]
max open files = 131072
log file = /var/log/ceph/$name.log
pid file = /var/run/ceph/$name.pid
[mon]
mon data = /ceph/mon/$name
[mon.alpha]
host = ct1
mon addr = 10.10.10.2:6789
[mds]
[mds.alpha]
host = ct1
[osd]
debug filestore = 20
filestore xattr use omap = true
osd data = /ceph/osd/$name
osd journal = /ceph/osd/$name/journal
osd journal size = 2000 ; journal size, in megabytes journal dio = false
journal aio = false

Quoted 7 lines

[osd.0]
host = ct1

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 3 lines · Henry C Chang

I looked into this problem earlier. The problem is that zfs does not return ERANGE when the size of value buffer passed to getxattr is too small. zfs returns with truncated xattr value.

Is this a bug in ZFS, or simply different behavior?

I've used ZFSonLinux quite a bit and they do seem to be very eager to fix bugs related to improper behavior, so if it's actually a bug I/someone can talk to them and try to get them to look at it soonish.

--Jeff

#4 lore raw

getxattr linux man page says ERANGE will be returned if the size of the value buffer is too small to hold the result. Thus, I think it is a bug of ZFS (or ZOL, at least).

2013/4/18 Jeff Mitchell <[email protected]>:

Quoted 15 lines
Quoted 4 lines · Henry C Chang

I looked into this problem earlier. The problem is that zfs does not return ERANGE when the size of value buffer passed to getxattr is too small. zfs returns with truncated xattr value.

Is this a bug in ZFS, or simply different behavior?

I've used ZFSonLinux quite a bit and they do seem to be very eager to fix bugs related to improper behavior, so if it's actually a bug I/someone can talk to them and try to get them to look at it soonish.

--Jeff

author
#5 lore raw
In reply to Jeff Mitchell

Adding Brian Behlendorf to the CC list, as we were just talking about this yesterday at LUG. :)

I suspect this is a bug; the posix docs indicate ERANGE is apprpriate here:

[ERANGE] value (as indicated by size) is too small to hold the
extended attribute data.

from http://www.unix.com/man-page/all/2/GETXATTR/.

sage

Quoted 19 lines · Jeff Mitchell
Quoted 3 lines · Henry C Chang

I looked into this problem earlier. The problem is that zfs does not return ERANGE when the size of value buffer passed to getxattr is too small. zfs returns with truncated xattr value.

Is this a bug in ZFS, or simply different behavior?

I've used ZFSonLinux quite a bit and they do seem to be very eager to fix bugs related to improper behavior, so if it's actually a bug I/someone can talk to them and try to get them to look at it soonish.

--Jeff

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to Jeff Mitchell
Quoted 8 lines · Jeff Mitchell
Quoted 4 lines · Henry C Chang

I looked into this problem earlier. The problem is that zfs does not return ERANGE when the size of value buffer passed to getxattr is too small. zfs returns with truncated xattr value.

Is this a bug in ZFS, or simply different behavior?

Took a brief look at the zfs code, seems like a zfs bug.

module/zfs/zpl_xattr.c +0 -0
index c03764f..96db7dd 100644
@@ -263,6 +263,9 @@ zpl_xattr_get_sa(struct inode *ip, const char

*name, void *value, size_t size)

        if (!size)
                return (nv_size);

+ if (size < nv_size)
+ return (-ERANGE);
+

        memcpy(value, nv_value, MIN(size, nv_size));

        return (MIN(size, nv_size));

This should fix it. Not tested of course.

Yehuda

author
#7 lore raw

[Adding Brian to CC list again :)]

Quoted 39 lines · Yehuda Sadeh
Quoted 8 lines · Jeff Mitchell
Quoted 4 lines · Henry C Chang

I looked into this problem earlier. The problem is that zfs does not return ERANGE when the size of value buffer passed to getxattr is too small. zfs returns with truncated xattr value.

Is this a bug in ZFS, or simply different behavior?

Took a brief look at the zfs code, seems like a zfs bug.

module/zfs/zpl_xattr.c +3 -0
index c03764f..96db7dd 100644
@@ -263,6 +263,9 @@ zpl_xattr_get_sa(struct inode *ip, const char
 *name, void *value, size_t size)
        if (!size)
                return (nv_size);
 
+       if (size < nv_size)
+               return (-ERANGE);
+
        memcpy(value, nv_value, MIN(size, nv_size));
 
        return (MIN(size, nv_size));

This should fix it. Not tested of course.

Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 31 lines · Sage Weil

[Adding Brian to CC list again :)]

Quoted 27 lines · Yehuda Sadeh
Quoted 8 lines · Jeff Mitchell
Quoted 4 lines · Henry C Chang

I looked into this problem earlier. The problem is that zfs does not return ERANGE when the size of value buffer passed to getxattr is too small. zfs returns with truncated xattr value.

Is this a bug in ZFS, or simply different behavior?

Took a brief look at the zfs code, seems like a zfs bug.

module/zfs/zpl_xattr.c +3 -0
index c03764f..96db7dd 100644
@@ -263,6 +263,9 @@ zpl_xattr_get_sa(struct inode *ip, const char
 *name, void *value, size_t size)
        if (!size)
                return (nv_size);
 
+       if (size < nv_size)
+               return (-ERANGE);
+
        memcpy(value, nv_value, MIN(size, nv_size));
 
Quoted 4 lines
Quoted 4 lines
        return (MIN(size, nv_size));

This should fix it. Not tested of course.

Well, looking at the code again it's not going to work, as setxattr is going to fail with ERANGE.

Yehuda

#9 lore raw
Quoted 35 lines · Yehuda Sadeh
Quoted 34 lines · Sage Weil

[Adding Brian to CC list again :)]

Quoted 30 lines · Yehuda Sadeh
Quoted 8 lines · Jeff Mitchell
Quoted 4 lines · Henry C Chang

I looked into this problem earlier. The problem is that zfs does not return ERANGE when the size of value buffer passed to getxattr is too small. zfs returns with truncated xattr value.

Is this a bug in ZFS, or simply different behavior?

Took a brief look at the zfs code, seems like a zfs bug.

module/zfs/zpl_xattr.c +3 -0
index c03764f..96db7dd 100644
@@ -263,6 +263,9 @@ zpl_xattr_get_sa(struct inode *ip, const char
 *name, void *value, size_t size)
         if (!size)
                 return (nv_size);
 
+       if (size < nv_size)
+               return (-ERANGE);
+
         memcpy(value, nv_value, MIN(size, nv_size));
 
         return (MIN(size, nv_size));
Quoted 7 lines
Quoted 1 line
Quoted 1 line

This should fix it. Not tested of course.

Well, looking at the code again it's not going to work, as setxattr is going to fail with ERANGE.

Yehuda

That does sounds like a zfs bug, According to getxattr(2) it should return ERANGE if the buffer is too small. I'll take a look but it's strange that this hasn't surfaced before.

If the size of the value buffer is too small to hold the result, errno is set to ERANGE.

Thanks,
Brian

#10 lore raw
In reply to Yehuda Sadeh

Here's a patch for the ERANGE error (lightly tested). Sage's patch looks good but only covers one of two code paths for xattrs. With zfs they may either be stored as a system attribute which is usually close to the dnode on disk (zfs set xattr=sa pool/dataset). Or they may be stored in their own object which is how it's implemented on Solaris (zfs set xattr=on pool/dataset). The second method is still the default for compatibility reasons even though it's slower. Sage's patch only covered the SA case.

Quoted 2 lines

Well, looking at the code again it's not going to work, as setxattr is going to fail with ERANGE.

Why? We support an arbitrary number of maximum sized xattrs (65536). What am I missing here?

Incidentally, does anybody know of an good xattr test suite we could add to our regression tests?

Thanks,
Brian

module/zfs/zpl_xattr.c +9 -1
index c03764f..9f4d63c 100644
@@ -225,6 +225,11 @@ zpl_xattr_get_dir(struct inode *ip, const char *name, void *value,
                goto out;
        }
 
+       if (size < i_size_read(xip)) {
+               error = -ERANGE;
+               goto out;
+       }
+
        error = zpl_read_common(xip, value, size, 0, UIO_SYSSPACE, 0, cr);
 out:
        if (xip)
@@ -263,7 +268,10 @@ zpl_xattr_get_sa(struct inode *ip, const char *name, void *value, size_t size)
        if (!size)
                return (nv_size);
 
-       memcpy(value, nv_value, MIN(size, nv_size));
+       if (size < nv_size)
+               return (-ERANGE);
+
+       memcpy(value, nv_value, size);
 
        return (MIN(size, nv_size));
 }
#11 lore raw
Quoted 40 lines · Brian Behlendorf

Here's a patch for the ERANGE error (lightly tested). Sage's patch looks good but only covers one of two code paths for xattrs. With zfs they may either be stored as a system attribute which is usually close to the dnode on disk (zfs set xattr=sa pool/dataset). Or they may be stored in their own object which is how it's implemented on Solaris (zfs set xattr=on pool/dataset). The second method is still the default for compatibility reasons even though it's slower. Sage's patch only covered the SA case.

Quoted 2 lines

Well, looking at the code again it's not going to work, as setxattr is going to fail with ERANGE.

Why? We support an arbitrary number of maximum sized xattrs (65536). What am I missing here?

Incidentally, does anybody know of an good xattr test suite we could add to our regression tests?

Thanks,
Brian

module/zfs/zpl_xattr.c +5 -0
index c03764f..9f4d63c 100644
@@ -225,6 +225,11 @@ zpl_xattr_get_dir(struct inode *ip, const char *name,
 void *value,
                goto out;
        }
 
+       if (size < i_size_read(xip)) {
+               error = -ERANGE;
+               goto out;
+       }
+
        error = zpl_read_common(xip, value, size, 0, UIO_SYSSPACE, 0, cr);
 out:

if (xip)

module/zfs/zpl_xattr.c zpl_xattr_get_sa(struct inode *ip, const char *name, · line 274

Quoted 8 lines
module/zfs/zpl_xattr.c +2 -1
@@ -263,7 +268,10 @@ zpl_xattr_get_sa(struct inode *ip, const char *name,
 void *value, size_t size)
        if (!size)
                return (nv_size);
 
-       memcpy(value, nv_value, MIN(size, nv_size));
 
+       if (size < nv_size)
+               return (-ERANGE);

Note, that zpl_xattr_get_sa() is called by __zpl_xattr_get() which can also be called by zpl_xattr_get() to test for xattr existence. So it needs to make sure that zpl_xattr_set() doesn't fail if getting -ERANGE.

Quoted 4 lines
module/zfs/zpl_xattr.c +2 -0
+
+       memcpy(value, nv_value, size);
 
        return (MIN(size, nv_size));

No need for MIN() here.

Yehuda

#12 lore raw

Sorry to disturb, but what is the raeson / advantage of using zfs for ceph?

Greets,
Stefan
Am 17.04.2013 21:07, schrieb Yehuda Sadeh:

Quoted 69 lines · Brian Behlendorf
Quoted 40 lines

Here's a patch for the ERANGE error (lightly tested). Sage's patch looks good but only covers one of two code paths for xattrs. With zfs they may either be stored as a system attribute which is usually close to the dnode on disk (zfs set xattr=sa pool/dataset). Or they may be stored in their own object which is how it's implemented on Solaris (zfs set xattr=on pool/dataset). The second method is still the default for compatibility reasons even though it's slower. Sage's patch only covered the SA case.

Quoted 2 lines

Well, looking at the code again it's not going to work, as setxattr is going to fail with ERANGE.

Why? We support an arbitrary number of maximum sized xattrs (65536). What am I missing here?

Incidentally, does anybody know of an good xattr test suite we could add to our regression tests?

Thanks,
Brian

module/zfs/zpl_xattr.c +5 -0
index c03764f..9f4d63c 100644
@@ -225,6 +225,11 @@ zpl_xattr_get_dir(struct inode *ip, const char *name,
 void *value,
                 goto out;
         }
 
+       if (size < i_size_read(xip)) {
+               error = -ERANGE;
+               goto out;
+       }
+
         error = zpl_read_common(xip, value, size, 0, UIO_SYSSPACE, 0, cr);
  out:

if (xip)

module/zfs/zpl_xattr.c zpl_xattr_get_sa(struct inode *ip, const char *name, · line 274

Quoted 8 lines
module/zfs/zpl_xattr.c +2 -1
@@ -263,7 +268,10 @@ zpl_xattr_get_sa(struct inode *ip, const char *name,
 void *value, size_t size)
         if (!size)
                 return (nv_size);
 
-       memcpy(value, nv_value, MIN(size, nv_size));
 
+       if (size < nv_size)
+               return (-ERANGE);

Note, that zpl_xattr_get_sa() is called by __zpl_xattr_get() which can also be called by zpl_xattr_get() to test for xattr existence. So it needs to make sure that zpl_xattr_set() doesn't fail if getting -ERANGE.

Quoted 4 lines
module/zfs/zpl_xattr.c +2 -0
+
+       memcpy(value, nv_value, size);
 
         return (MIN(size, nv_size));

No need for MIN() here.

Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw

I'll let Brian talk about the virtues of ZFS, but from my perspective it's an interesting option as there are a lot of folks banging on it for NFS servers and it has some interesting capabilities. I have no idea how well it will work in practice, but if we can show that Ceph can run on it at least people can try it out and give us feedback.

Mark

Quoted 88 lines · Stefan Priebe

Sorry to disturb, but what is the raeson / advantage of using zfs for ceph?

Greets,
Stefan
Am 17.04.2013 21:07, schrieb Yehuda Sadeh:

Quoted 70 lines
Quoted 48 lines · Brian Behlendorf

Here's a patch for the ERANGE error (lightly tested). Sage's patch looks
good but only covers one of two code paths for xattrs. With zfs they may
either be stored as a system attribute which is usually close to the dnode
on disk (zfs set xattr=sa pool/dataset). Or they may be stored in their own
object which is how it's implemented on Solaris (zfs set xattr=on pool/dataset). The second method is still the default for compatibility reasons even though it's slower. Sage's patch only covered the SA case.

Quoted 2 lines

Well, looking at the code again it's not going to work, as setxattr is going to fail with ERANGE.

Why? We support an arbitrary number of maximum sized xattrs (65536). What
am I missing here?

Incidentally, does anybody know of an good xattr test suite we could add to
our regression tests?

Thanks,
Brian

module/zfs/zpl_xattr.c +5 -0
index c03764f..9f4d63c 100644
@@ -225,6 +225,11 @@ zpl_xattr_get_dir(struct inode *ip, const char
 *name,
 void *value,
                 goto out;
         }
 
+       if (size < i_size_read(xip)) {
+               error = -ERANGE;
+               goto out;
+       }
+
         error = zpl_read_common(xip, value, size, 0, UIO_SYSSPACE,

0, cr);
out:
if (xip)

module/zfs/zpl_xattr.c zpl_xattr_get_sa(struct inode *ip, const char · line 275

Quoted 9 lines
module/zfs/zpl_xattr.c +2 -1
@@ -263,7 +268,10 @@ zpl_xattr_get_sa(struct inode *ip, const char
 *name,
 void *value, size_t size)
         if (!size)
                 return (nv_size);
 
-       memcpy(value, nv_value, MIN(size, nv_size));
 
+       if (size < nv_size)
+               return (-ERANGE);

Note, that zpl_xattr_get_sa() is called by __zpl_xattr_get() which can also be called by zpl_xattr_get() to test for xattr existence. So it needs to make sure that zpl_xattr_set() doesn't fail if getting -ERANGE.

Quoted 4 lines
module/zfs/zpl_xattr.c +2 -0
+
+       memcpy(value, nv_value, size);
         return (MIN(size, nv_size));
Quoted 9 lines

No need for MIN() here.

Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw
Quoted 4 lines · Stefan Priebe
Quoted 3 lines

Sorry to disturb, but what is the raeson / advantage of using zfs for ceph?

A few things off the top of my head:

1) Very mature filesystem with full xattr support (this bug notwithstanding) and copy-on-write snapshots. While the port to Linux sometimes has some rough edges (but in my experience over the past few years is generally very good), the main code from Solaris (and now the Illumos project) is well-tested and very well regarded. Btrfs has many of the same features, but in my real-world experience I've had multiple btrfs filesystems go corrupt with very innocuous usage patterns and across a variety of kernel versions. The zfsonlinux bugs don't tend to be data-destructive, once data is written to it.
2) Very intelligent caching; also supports external devices (like SSDs) for a level 2 cache. This speeds up reads dramatically.
3) Very robust error-checking. There are lots of stories of ZFS finding bad memory, bad controllers, and bad hard drives because of its checksumming (which you can optionally turn off for speed). If you set up the OSDs such that each OSD is based off of a ZFS mirror, you get these benefits locally. For some people, especially when heavy on reads (due to the intelligent caching), a solution that knocks the remote replication level down by one but uses local mirrors for OSDs may provide good functionality and safety compromises.

--Jeff

#15 lore raw
In reply to Mark Nelson
Quoted 1 line · Mark Nelson

I'll let Brian talk about the virtues of ZFS,

I think the virtues of ZFS have been discussed at length in various other forums. But in short it brings some nice functionality to the table which may be useful to ceph and that's worth exploring.

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
module/zfs/zpl_xattr.c +5 -0
index c03764f..9f4d63c 100644
@@ -225,6 +225,11 @@ zpl_xattr_get_dir(struct inode *ip, const char
 *name,
 void *value,
                 goto out;
         }
 
+       if (size < i_size_read(xip)) {
+               error = -ERANGE;
+               goto out;
+       }
+
         error = zpl_read_common(xip, value, size, 0, UIO_SYSSPACE,

0, cr);
out:
if (xip)

module/zfs/zpl_xattr.c +0 -1
@@ -263,7 +268,10 @@ zpl_xattr_get_sa(struct inode *ip, const char
 *name,
 void *value, size_t size)
         if (!size)
                 return (nv_size);
 
-       memcpy(value, nv_value, MIN(size, nv_size));
 
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

module/zfs/zpl_xattr.c zpl_xattr_get_sa(struct inode *ip, const char · line 275

Quoted 2 lines
module/zfs/zpl_xattr.c +2 -0
+       if (size < nv_size)
+               return (-ERANGE);

Note, that zpl_xattr_get_sa() is called by __zpl_xattr_get() which can also be called by zpl_xattr_get() to test for xattr existence. So it needs to make sure that zpl_xattr_set() doesn't fail if getting -ERANGE.

This shouldn't be a problem. The zpl_xattr_get() call from zpl_xattr_set() passes a NULL value and zero size which will prevent it from hitting the ERANGE error. It will return instead the xattr size as expected.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
module/zfs/zpl_xattr.c +2 -0
+
+       memcpy(value, nv_value, size);
         return (MIN(size, nv_size));

No need for MIN() here.

Thanks for catching that.

I've opened a pull request at github with the updated fix and kicked it off for automated testing. It would be nice to verify this resolves the crash.

https://github.com/zfsonlinux/zfs/pull/1409

module/zfs/zpl_xattr.c +10 -2
index c03764f..42a06ad 100644
@@ -225,6 +225,11 @@ zpl_xattr_get_dir(struct inode *ip, const char *name, void
                goto out;
        }
 
+       if (size < i_size_read(xip)) {
+               error = -ERANGE;
+               goto out;
+       }
+
        error = zpl_read_common(xip, value, size, 0, UIO_SYSSPACE, 0, cr);
 out:
        if (xip)
@@ -263,9 +268,12 @@ zpl_xattr_get_sa(struct inode *ip, const char *name, void *
        if (!size)
                return (nv_size);
 
-       memcpy(value, nv_value, MIN(size, nv_size));
+       if (size < nv_size)
+               return (-ERANGE);
+
+       memcpy(value, nv_value, size);
 
-       return (MIN(size, nv_size));
+       return (size);
 }
 
 static int
#16 lore raw

Sorry, off the topic. I am wondering if we use zfs as the underlying filesystem for ceph osd and let osd filestore do sync writes, do we still need the osd journal?

2013/4/18 Brian Behlendorf <[email protected]>:

Quoted 105 lines · Mark Nelson
Quoted 2 lines

I'll let Brian talk about the virtues of ZFS,

I think the virtues of ZFS have been discussed at length in various other forums. But in short it brings some nice functionality to the table which may be useful to ceph and that's worth exploring.

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
module/zfs/zpl_xattr.c +5 -0
index c03764f..9f4d63c 100644
@@ -225,6 +225,11 @@ zpl_xattr_get_dir(struct inode *ip, const char
 *name,
 void *value,
                 goto out;
         }
 
+       if (size < i_size_read(xip)) {
+               error = -ERANGE;
+               goto out;
+       }
+
         error = zpl_read_common(xip, value, size, 0, UIO_SYSSPACE,

0, cr);
out:
if (xip)

module/zfs/zpl_xattr.c +0 -1
@@ -263,7 +268,10 @@ zpl_xattr_get_sa(struct inode *ip, const char
 *name,
 void *value, size_t size)
         if (!size)
                 return (nv_size);
 
-       memcpy(value, nv_value, MIN(size, nv_size));
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

module/zfs/zpl_xattr.c zpl_xattr_get_sa(struct inode *ip, const char *name, void * · line 272

Quoted 2 lines
module/zfs/zpl_xattr.c +2 -0
+       if (size < nv_size)
+               return (-ERANGE);

Note, that zpl_xattr_get_sa() is called by __zpl_xattr_get() which can also be called by zpl_xattr_get() to test for xattr existence. So it needs to make sure that zpl_xattr_set() doesn't fail if getting -ERANGE.

This shouldn't be a problem. The zpl_xattr_get() call from zpl_xattr_set() passes a NULL value and zero size which will prevent it from hitting the ERANGE error. It will return instead the xattr size as expected.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
module/zfs/zpl_xattr.c +2 -0
+
+       memcpy(value, nv_value, size);
         return (MIN(size, nv_size));

No need for MIN() here.

Thanks for catching that.

I've opened a pull request at github with the updated fix and kicked it off for automated testing. It would be nice to verify this resolves the crash.

https://github.com/zfsonlinux/zfs/pull/1409

module/zfs/zpl_xattr.c +0 -0
index c03764f..42a06ad 100644
@@ -225,6 +225,11 @@ zpl_xattr_get_dir(struct inode *ip, const char *name,

void

                goto out;
        }
module/zfs/zpl_xattr.c +5 -0
+       if (size < i_size_read(xip)) {
+               error = -ERANGE;
+               goto out;
+       }
+
        error = zpl_read_common(xip, value, size, 0, UIO_SYSSPACE, 0, cr);
 out:
        if (xip)
@@ -263,9 +268,12 @@ zpl_xattr_get_sa(struct inode *ip, const char *name,

void *

        if (!size)
                return (nv_size);
module/zfs/zpl_xattr.c +5 -2
-       memcpy(value, nv_value, MIN(size, nv_size));
+       if (size < nv_size)
+               return (-ERANGE);
+
+       memcpy(value, nv_value, size);
 
-       return (MIN(size, nv_size));
+       return (size);
 }
 
 static int
#17 lore raw
In reply to Brian Behlendorf

Am 17.04.2013 um 23:14 schrieb Brian Behlendorf <[email protected]>:

Quoted 4 lines · Mark Nelson
Quoted 1 line

I'll let Brian talk about the virtues of ZFS,

I think the virtues of ZFS have been discussed at length in various other forums. But in short it brings some nice functionality to the table which may be useful to ceph and that's worth exploring.

Sure I know about the advantages of zfs.

I just thought about how ceph can benefit. Right now I've no idea. The osds should be single disks so zpool, zraid does not matter. Ceph does it own scrubbing and check summing and instead of btrfs ceph does not know how to use snapshots with zfs. That's why I'm asking.

Greets,
Stefan

author
#18 lore raw
Quoted 5 lines · Stefan Priebe - Profihost AG

Am 17.04.2013 um 23:14 schrieb Brian Behlendorf <[email protected]>:

Quoted 3 lines · Mark Nelson
Quoted 1 line

I'll let Brian talk about the virtues of ZFS,

Quoted 7 lines
Quoted 1 line

I think the virtues of ZFS have been discussed at length in various other forums. But in short it brings some nice functionality to the table which may be useful to ceph and that's worth exploring.

Sure I know about the advantages of zfs.

I just thought about how ceph can benefit. Right now I've no idea. The osds should be single disks so zpool, zraid does not matter. Ceph does it own scrubbing and check summing and instead of btrfs ceph does not know how to use snapshots with zfs. That's why I'm asking.

The main things that come to mind:

- zfs checksumming
- ceph can eventually use zfs snapshots similarly to how it uses btrfs snapshots to create stable checkpoints as journal reference points, allowing parallel (instead of writeahead) journaling
- can use raidz beneath a single ceph-osd for better reliability (e.g., 2x
* raidz instead of 3x replication)

ZFS doesn't have a clone function that we can use to enable efficient cephfs/rbd/rados snaps, but maybe this will motivate someone to implement one. :)

sage

#19 lore raw

Sage Weil wrote:

<snip>

Quoted 9 lines

The main things that come to mind:

- zfs checksumming
- ceph can eventually use zfs snapshots similarly to how it uses btrfs snapshots to create stable checkpoints as journal reference points, allowing parallel (instead of writeahead) journaling
- can use raidz beneath a single ceph-osd for better reliability (e.g., 2x
* raidz instead of 3x replication)

Quoted 3 lines

ZFS doesn't have a clone function that we can use to enable efficient cephfs/rbd/rados snaps, but maybe this will motivate someone to implement one. :)

Since Btrfs has implemented raid5/6 support (meaning raidz is only a feature gain if you want 3x parity, which is unlikely to be useful for an OSD[1]), the checksumming may be the only real benefit since it supports sha256 (in addition to the non-cryptographic fletcher2/fletcher4), whereas btrfs only has crc32c at this time.

[1] A raidz3 with 4 disks is basically raid1, at which point you may as well use Ceph-level replication. And a 5-or-more-disk OSD strikes me as a questionable way to set it up, considering Ceph's strengths.

#20 lore raw
Quoted 5 lines · Alex Elsayed

Since Btrfs has implemented raid5/6 support (meaning raidz is only a feature gain if you want 3x parity, which is unlikely to be useful for an OSD[1]), the checksumming may be the only real benefit since it supports sha256 (in addition to the non-cryptographic fletcher2/fletcher4), whereas btrfs only has crc32c at this time.

Plus (in my real-world experience) *far* better robustness. If Ceph could use either and both had feature parity, I'd choose ZFS in a heartbeat. I've had too many simple Btrfs filesystems go corrupt, not even using any fancy RAID features.

I wasn't aware that Ceph was using btrfs' file-scope clone command. ZFS doesn't have that, although in theory with the new capabilities system it could be supported in one implementation without requiring an on-disk format change.

--Jeff