cifsd: update to git (2019-11-27), fix reload/restart not applying smb.conf changes 10653/head
authorAndy Walsh <andy.walsh44+github@gmail.com>
Wed, 27 Nov 2019 21:11:16 +0000 (22:11 +0100)
committerAndy Walsh <andy.walsh44+github@gmail.com>
Wed, 27 Nov 2019 21:11:16 +0000 (22:11 +0100)
* fix reload/restart not applying luci/smb.conf changes
* remove hotfix for 'read only = no' (fixed by upstream)
* update documentation, example
*cifsd: fix the lost of dos file attributes
*cifsd: store FILE_ATTRIBUTE_SPARSE into xattr
*cifsd: release v2.0.2
*cifsd-tools: add smb.conf.list file to show supported parameters list
*cifsd-tools: set CIFSD_SHARE_FLAG_WRITEABLE flags if read only = no
*cifsd-tools: release cifsd-tools v2.0.2

Signed-off-by: Andy Walsh <andy.walsh44+github@gmail.com>
kernel/cifsd/Makefile
net/cifsd-tools/Makefile
net/cifsd-tools/files/cifsd.config.example
net/cifsd-tools/files/cifsd.init
net/cifsd-tools/files/smb.conf.template

index 351879f2fc43f9eb6667e2170e44e3aa207852ce..890a5eb4c11704a3473e1bbac470fe81587bb684 100644 (file)
@@ -5,9 +5,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd.git
-PKG_SOURCE_DATE:=2019-11-22
-PKG_SOURCE_VERSION:=511ee7e852c0be06b74fbb3eba69760b86658679
-PKG_MIRROR_HASH:=23040d73230ff6afcea46cf9c51a1aab7b706859471de204da4824bfea5934c8
+PKG_SOURCE_DATE:=2019-11-27
+PKG_SOURCE_VERSION:=b8675c8ac144ece00f3e6bcc5436c8ace99e23e9
+PKG_MIRROR_HASH:=3d67af87f30d837f95510663efc42f1451651dc235987408924b56cb277fc8e8
 
 PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
 PKG_LICENSE:=GPL-2.0-or-later
index 2990eeeed4237c75485f324e18d55a1c848538b6..656cc10d2770a3469f1b93dd2abaef91a2df0f39 100644 (file)
@@ -5,9 +5,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd-tools.git
-PKG_SOURCE_DATE:=2019-11-25
-PKG_SOURCE_VERSION:=49d0c40129fe22161999ffb7e059b90089f23078
-PKG_MIRROR_HASH:=cd3702f1387ab643233200dcf5c244989b6d6efa196c69e842791e434eb3eea7
+PKG_SOURCE_DATE:=2019-11-27
+PKG_SOURCE_VERSION:=06fd4153a5d5af1f96a20234f397bd149a8e4832
+PKG_MIRROR_HASH:=2849d2af471e327abc8d67afc91ca767c410e2b307d6554531a0b387d9ad909a
 
 PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
 PKG_LICENSE:=GPL-2.0-or-later
@@ -46,7 +46,7 @@ define Package/cifsd-tools/install
        $(INSTALL_BIN) ./files/cifsd.init $(1)/etc/init.d/cifsd
        # copy examples until we have a wiki page
        $(INSTALL_DATA) ./files/cifsd.config.example $(1)/etc/cifs/
-       $(INSTALL_DATA) ./files/smb.conf.help $(1)/etc/cifs/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/Documentation/configuration.txt $(1)/etc/cifs/
 endef
 
 define Package/cifsd-tools/conffiles
index d0ffa5b466e123e7911be71b42c46c8b8afbff75..dfe08adc6f3ad29e18d059336a9c0d0e3bc10319 100644 (file)
@@ -4,8 +4,8 @@ config globals
 config share
        option name 'testshare'
        option path '/tmp'
+       option read_only 'no'
        option guest_ok 'yes'
        option create_mask '0666'
        option dir_mask '0777'
-       option writeable 'yes'
        option force_root '1'
index c06e19284b5bf5fb15f3427386c5a6a58042c53e..04849184212af67e31e1864da71a17393dbe7504 100644 (file)
@@ -103,12 +103,8 @@ smb_add_share()
 
                [ -n "$browseable" ] && printf "\tbrowseable = %s\n" "$browseable"
                [ -n "$read_only" ] && printf "\tread only = %s\n" "$read_only"
-               # possible upstream bug?
-               if [ "$read_only" = "no" ]; then
-                       printf "\twriteable = yes\n"
-               else
-                       [ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable"
-               fi
+               [ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable"
+
                [ -n "$guest_ok" ] && printf "\tguest ok = %s\n" "$guest_ok"
                [ -n "$inherit_owner" ] && printf "\tinherit owner = %s\n" "$inherit_owner"
 
@@ -153,6 +149,15 @@ start_service()
                exit 1
        fi
 
+       if [ -e /sys/module/cifsd ]; then
+               if [ -e /sys/class/cifsd-control/kill_server ]; then
+                       # upstream "BUG": ensure changes in smb.conf are reflected on a running kernel-server
+                       echo hard > /sys/class/cifsd-control/kill_server
+                       # we need a extra timeout for the reset
+                       sleep 5
+               fi
+       fi
+       
        modprobe cifsd 2> /dev/null
        if [ ! -e /sys/module/cifsd ]; then
                logger -t 'cifsd' "modprobe of cifsd module failed, can\'t start cifsd!"
@@ -162,6 +167,7 @@ start_service()
        logger -t 'cifsd' "Starting CIFS/SMB userspace service."
        procd_open_instance
        procd_set_param command /usr/sbin/cifsd --n
+       procd_set_param file /var/etc/cifs/smb.conf
        procd_close_instance
 }
 
@@ -169,20 +175,33 @@ stop_service()
 {
        logger -t 'cifsd' "Stopping CIFSD userspace service."
        killall cifsd > /dev/null 2>&1
-       sleep 1
-       [ -e /sys/class/cifsd-control/kill_server ] && echo hard > /sys/class/cifsd-control/kill_server
-       sleep 2
+       
+       [ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1
+       # With open smb connections rmmod is not possible, without waiting for the long 'ipc timeout', so we use 'kill_server'!
+       if [ -e /sys/module/cifsd ]; then
+               logger -t 'cifsd' "triggering kill_server"
+               if [ -e /sys/class/cifsd-control/kill_server ]; then
+                       echo hard > /sys/class/cifsd-control/kill_server
+                       # we need a extra timeout for the reset
+                       sleep 5
+               fi
+       fi
+       # next try
        [ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1
-       # With open smb connections rmmod takes longer
+       # check again
        if [ -e /sys/module/cifsd ]; then
-               sleep 5
-               rmmod cifsd > /dev/null 2>&1
+               # wait more...
+               sleep 3
+       fi
+       # last try
+       [ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1
+       
+       if [ -e /sys/module/cifsd ]; then
+               logger -t 'cifsd' "module still loaded after 8s timeout"
        fi
        [ -f /tmp/cifsd.lock ] && rm /tmp/cifsd.lock
 }
 
-reload_service() {
-       stop_service "$@"
-       sleep 1
-       start_service "$@"
-}
+# reload_service() {
+       # restart "$@"
+# }
index aa54bf2f652f461f6cd44b76d5dd34d2db473dea..2da98b16e2b6b1c0a8e3bc787aa4365621f9e15e 100644 (file)
@@ -4,6 +4,6 @@
        workgroup = |WORKGROUP|
        interfaces = |INTERFACES|
        bind interfaces only = yes
-       ipc timeout = 8
+       ipc timeout = 20
        deadtime = 15
        map to guest = Bad User