Whamcloud - gitweb
LU-812 llite: O_LOV_DELAY_CREATE conflicts with FMODE_NONOTIFY
authorLiu Xuezhao <xuezhao.liu@emc.com>
Sat, 25 Aug 2012 08:19:20 +0000 (16:19 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 6 Sep 2012 18:24:12 +0000 (14:24 -0400)
Kernel 2.6.36 introduces FMODE_NONOTIFY and defines it as 0x1000000
(commit 12ed2e36c98aec6c41559222e311f4aa15d254b6), this causes the
confliction with O_LOV_DELAY_CREATE which is now defined as octal
0100000000.
This confliction causes kernel remove this flag in build_open_flags,
then "lfs setstripe" a new file will fail with -EEXIST(stripe
already set).

This patch changes O_LOV_DELAY_CREATE to 0120000000(0x1400000)
to make it works for new kernel and compatible with old version
statically linked binary.

Another change is starting to build dynamic linked version of
liblustreapi.so.

Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Change-Id: I643d3734cfdc2f45099fc6be663a370c2dcc8ea3
Reviewed-on: http://review.whamcloud.com/3779
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Iurii Golovach <Iurii_Golovach@xyratex.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
lustre.spec.in
lustre/include/lustre/lustre_user.h
lustre/utils/Makefile.am

index f3568bf..afbc3c2 100644 (file)
@@ -225,6 +225,7 @@ cat >lustre.files <<EOF
 
 %attr(-, root, root) %{_libdir}/libptlctl.a
 %attr(-, root, root) %{_libdir}/liblustreapi.a
+%attr(-, root, root) %{_libdir}/liblustreapi.so
 %attr(-, root, root) /usr/include/lustre
 %attr(-, root, root) /usr/include/libcfs
 
index 02d6e44..ca7c4b2 100644 (file)
@@ -171,7 +171,13 @@ struct obd_statfs {
 
 #define MAX_OBD_NAME 128 /* If this changes, a NEW ioctl must be added */
 
-#define O_LOV_DELAY_CREATE 0100000000  /* hopefully this does not conflict */
+/* Hopefully O_LOV_DELAY_CREATE does not conflict with standard O_xxx flags.
+ * Previously it was defined as 0100000000 and conflicts with FMODE_NONOTIFY
+ * which was added since kernel 2.6.36, so we redefine it as 020000000.
+ * To be compatible with old version's statically linked binary, finally we
+ * define it as (020000000 | 0100000000).
+ * */
+#define O_LOV_DELAY_CREATE      0120000000
 
 #define LL_FILE_IGNORE_LOCK     0x00000001
 #define LL_FILE_GROUP_LOCKED    0x00000002
index dcf340f..f207536 100644 (file)
@@ -34,6 +34,7 @@ sbin_SCRIPTS = $(sbin_scripts)
 endif # UTILS
 
 lib_LIBRARIES = liblustreapi.a libiam.a
+noinst_LIBRARIES = liblustreapitmp.a
 
 lctl_SOURCES = lustre_lfsck.c obd.c lustre_cfg.c lctl.c obdctl.h
 lctl_LDADD := $(LIBREADLINE) liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS)
@@ -77,7 +78,24 @@ llverdev_LDADD := $(EXT2FSLIB) $(BLKIDLIB)
 
 L_IOCTL := $(top_builddir)/libcfs/libcfs/util/l_ioctl.c
 L_KERNELCOMM := $(top_builddir)/libcfs/libcfs/kernel_user_comm.c
-liblustreapi_a_SOURCES = liblustreapi.c $(L_IOCTL) $(L_KERNELCOMM)
+liblustreapitmp_a_SOURCES = liblustreapi.c $(L_IOCTL) $(L_KERNELCOMM)
+
+# build static and shared lib lustreapi
+liblustreapi.a : liblustreapitmp.a
+       rm -f liblustreapi.a liblustreapi.so
+       gcc -shared -o liblustreapi.so `ar -t liblustreapitmp.a`
+       mv liblustreapitmp.a liblustreapi.a
+
+install-exec-hook: liblustreapi.so
+       @$(NORMAL_INSTALL)
+       $(mkinstalldirs) $(DESTDIR)$(libdir)
+       @list=$< ; for p in $$list; do \
+         if test -f $$p; then \
+           f="`echo $$p | sed -e 's|^.*/||'`"; \
+           echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$f"; \
+           $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$f; \
+         else :; fi; \
+       done
 
 libiam_a_SOURCES = libiam.c