From 12aa9058df9bae0e0409f8554f70498caa59aa46 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Sat, 17 Nov 2018 13:14:24 +0530 Subject: geo-rep: Fix syncing of files with non-ascii filenames Problem: Creation of files/directories with non-ascii names fails to sync to the slave. It crashes with below traceback on slave. ... File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/repce.py", line 118, in worker res = getattr(self.obj, rmeth)(*in_data[2:]) File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/resource.py", line 709, in entry_ops [ESTALE, EINVAL, EBUSY]) File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/syncdutils.py", line 546, in errno_wrap return call(*arg) File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/libcxattr.py", line 83, in lsetxattr cls.raise_oserr() File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/libcxattr.py", line 38, in raise_oserr raise OSError(errn, os.strerror(errn)) OSError: [Errno 12] Cannot allocate memory Cause: The length calculation arguments passed to blob creation was done before encoding. Hence was failing in gfid-access layer. Fix: It appears that the calculating lenght properly fixes this issue. But it will cause issues in other places in 'python2' and not in 'python3'. So encoding and decoding each required string to make geo-rep compatible with both 'python2' and 'python3' is a nightmare and is not fool proof. Hence kept 'python2' code as is with out encode/decode and applied encode/decode only to 'python3' Added non-ascii filename tests to regression Backport of: > Patch: https://review.gluster.org/21668 > BUG: 1650893 > Change-Id: I35cfaf848e07b1a0b5cb93c01b98b472f08271a6 > Signed-off-by: Kotresh HR fixes: bz#1648642 Change-Id: I35cfaf848e07b1a0b5cb93c01b98b472f08271a6 Signed-off-by: Kotresh HR --- tests/geo-rep.rc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests/geo-rep.rc') diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc index c33ceaaa64e..da22c4befe4 100644 --- a/tests/geo-rep.rc +++ b/tests/geo-rep.rc @@ -40,34 +40,53 @@ function create_data() touch ${master_mnt}/${prefix}_f2 touch ${master_mnt}/${prefix}_f3 + # non-ascii filename test + echo "Hello non-ascii" > ${master_mnt}/${prefix}_f1_ಸಂತಸ + touch ${master_mnt}/${prefix}_f2_ಸಂತಸ + touch ${master_mnt}/${prefix}_f3_ಸಂತಸ + # dir mkdir ${master_mnt}/${prefix}_d1 mkdir ${master_mnt}/${prefix}_d2 mkdir ${master_mnt}/${prefix}_d3 - # Hardlink + # non-ascii dir and filename test + mkdir ${master_mnt}/${prefix}_d1_ನನ್ನ + mkdir ${master_mnt}/${prefix}_d2_ಸಂತಸ + mkdir ${master_mnt}/${prefix}_d3_ಸಂತಸ + echo "Hello non-ascii" > ${master_mnt}/${prefix}_d1_ನನ್ನ/ಸಂತಸ + + # Hardlink + non-ascii name ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1 + ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1_ಸಂತಸ # Symlink cd ${master_mnt} ln -s ${prefix}_f1 ${prefix}_sl1 + ln -s ${prefix}_f1 ${prefix}_sl1_ಸಂತಸ cd - # UNLINK rm ${master_mnt}/${prefix}_f2 + rm ${master_mnt}/${prefix}_f2_ಸಂತಸ # RMDIR rmdir ${master_mnt}/${prefix}_d2 + rmdir ${master_mnt}/${prefix}_d2_ಸಂತಸ # Rename - File mv ${master_mnt}/${prefix}_f3 ${master_mnt}/${prefix}_f4 + mv ${master_mnt}/${prefix}_f3_ಸಂತಸ ${master_mnt}/${prefix}_f4_ಸಂತಸ # Rename - Dir mv ${master_mnt}/${prefix}_d3 ${master_mnt}/${prefix}_d4 + mv ${master_mnt}/${prefix}_d3_ಸಂತಸ ${master_mnt}/${prefix}_d4_ಸಂತಸ # chown touch ${master_mnt}/${prefix}_chown_f1 chown 1000:1000 ${master_mnt}/${prefix}_chown_f1 + touch ${master_mnt}/${prefix}_chown_f1_ಸಂತಸ + chown 1000:1000 ${master_mnt}/${prefix}_chown_f1_ಸಂತಸ } function chown_file_ok() -- cgit